|
发表于 2024-9-3 14:50:57
|
显示全部楼层
void T5L_Flash(unsigned char mod,unsigned int addr,long addr_flash,unsigned int len)
{ ADR_H=0x00;
ADR_M=0x00;
ADR_L=0x04;
ADR_INC=0x01;
RAMMODE=0x8F; //启动读Flash
while(APP_ACK==0);
DATA3=mod;
DATA2=(unsigned char)(addr_flash>>16);
DATA1=(unsigned char)(addr_flash>>8);
DATA0=(unsigned char)(addr_flash&0xFE);
APP_EN=1;
while(APP_EN==1);
DATA3=(unsigned char)(addr>>8);
DATA2=(unsigned char)(addr&0xFE);
DATA1=(unsigned char)(len>>8);
DATA0=(unsigned char)(len&0xFE);
APP_EN=1;
while(APP_EN==1);
RAMMODE=0x00;
wait_ok(0x0004);
} //等待数据读取OK
ADR_L=0x04;这里为啥不是0x08。
void read_dgusii_vp(unsigned int addr,unsigned char *buf,unsigned int len)
{ unsigned char i;
i=(unsigned char)(addr&0x01);
addr=addr/2;
ADR_H=0x00;
ADR_M=(unsigned char)(addr>>8);
ADR_L=(unsigned char)(addr);
ADR_INC=0x01;
RAMMODE=0xAF;
while(APP_ACK==0);
while(len>0)
{ APP_EN=1;
while(APP_EN==1);
if((i==0)&&(len>0))
{ *buf++=DATA3;
*buf++=DATA2;
i=1;
len--; }
if((i==1)&&(len>0))
{ *buf++=DATA1;
*buf++=DATA0;
i=0;
len--; }}
RAMMODE=0x00;}
addr=addr/2;,这里addr为啥要除以2? |
|