1、code uint8 strint1 = I Love You !;/*void delay5ms(void) /误差 0us unsigned char a,b; for(b=185;b0;b-) for(a=12;aa-);*/发送一个字节void Send_Byte(uint8 dat) uint8 i; SCK = 0; for(i=0;i8;i+) SDA = dat&0x80; SCK = 1; dat = 1; SCK = 0; /读取一个字节数据uint8 Read_Byte(void) uint16 byte = 0;16; byte 4)|(byte8)&0x00ff; r
2、eturn (uint8)(byte);/读忙标志void Read_Busy(void) uint8 temp; CS = 1; do Send_Byte(0xfc);/发送读命令 temp = Read_Byte();/读取数据 while(temp&0x80); CS = 0;/发送命令void Write_Cmd(uint8 cmd) uint8 temph = 0; uint8 templ = 0; /制作发送命令格式 temph = cmd & 0xf0; templ = (cmd & 0x0f) 4; Read_Busy(); Send_Byte(0XF8);/发送命令命令 /发
3、送命令 Send_Byte(temph); Send_Byte(templ); /发送数据void Write_Dat(uint8 dat) /制作发送数据格式 temph = dat & templ = (dat & Send_Byte(0XFA);/发送数据命令/在指定位置显示半字宽字符void Dis_HCGROM(uint8 x,uint8 y,uint8 dat) uint8 addr; switch(y) case 0:addr = 0x80 + x;break; case 1:addr = 0x90 + x; case 2:addr = 0x88 + x; case 3:addr
4、 = 0x98 + x; default: Write_Cmd(addr); Write_Dat(dat); /指定位置显示字符串void Dis_String(uint8 x, uint8 y, uint8 len, uint8 *dat) uint8 addr,i; for(i = 0;i 8); Write_Dat(uint8)(dat);/LCD初始化void LCD_Init(void) /*RST = 0; delay5ms(); RST = 1; PSB = 0;*/ Write_Cmd(0X30); Write_Cmd(0X01); Write_Cmd(0X02); Write_Cmd(0X0C);void main(void) LCD_Init(); while(1) Dis_GB(0,0,0xc9b5); Dis_HCGROM(1,0,0x03); Dis_String(0,1,13,strint1); Dis_UNum8(0,2,250);