|
发表于 2024-10-13 09:25:33
|
显示全部楼层
本帖最后由 王文佳666 于 2024-10-13 09:28 编辑
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned long u32;
void SetDgusPage(unsigned char Page_ID)//系统接口地址0084进行函数封装
{
Write_Dgus(0x0085,Page_ID);
Write_Dgus(0x0084,0x5a01);
}
void Write_Dgus(u16 Dgus_Addr,u16 Val)//访问内部用写函数操作系统接口地址(此函数直接调用)
{ EA = 0;
ADR_H = 0x00;
ADR_M = (u8)((Dgus_Addr/2)>>8);
ADR_L = (u8)(Dgus_Addr/2);
RAMMODE = 0xAF; //读操作
while(!APP_ACK);
APP_EN = 1;
while(APP_EN);
RAMMODE = 0;
ADR_M = (u8)((Dgus_Addr/2)>>8);
ADR_L = (u8)(Dgus_Addr/2);
RAMMODE = 0x8F; //写操作
while(!APP_ACK);
if(Dgus_Addr%2){DATA1=(u8)(Val>>8); DATA0=(u8)(Val); }
else { DATA3 =(u8)(Val>>8); DATA2 =(u8)(Val);}
APP_EN = 1;
while(APP_EN);
RAMMODE = 0;
EA = 1;
} |
|