TA的每日心情 | 开心 2021-12-29 09:01 |
---|
签到天数: 1219 天 [LV.10]以坛为家III
|
楼主 |
发表于 2021-3-1 09:34
|
显示全部楼层
网上说和LCD1602差不多,看文档好像也差不多,所以是从LCD1602那改的,我下面的代码,LCD1602能显示,但是LCD12864不能,关键是我的LCD12864不写代码全都显示了,感觉不应该这样。
//12864初始化
void LCD12864_Init(void)
{
_LCD_DATADDR = 0xFF;
_LCD_DATAPORT=0x00;
_LCD_RWEDDR=0xFF;
LCD_Delay();
writecom(0x38,0);
LCD_Delay();
writecom(0x38,0);
LCD_Delay();
writecom(0x38,0);
LCD_Delay();
writecom(0x38,1);
writecom(0x08,1); //关闭显示
writecom(0x01,1); //显示清屏
writecom(0x06,1); //显示光标移动设置
writecom(0x0C,1); //显示开及光标设置
}
//LCD12864输出字符串
void LCD12864_WriteChar(uchar row,uchar col,uchar *pBuffer)
{
switch (row)
{
case 0:{row=0x80;break;}
case 1:{row=0x90;break;}
case 2:{row=0x88;break;}
default:{row=0x98;break;}
}
row+= col;
writecom(row,1);
_LCD_RS=1;
LCD_Delay();
_LCD_RW=0;
LCD_Delay();
while(*pBuffer)
{
LCD_Delay();
_LCD_DATAPORT=*pBuffer;
LCD_Delay();
_LCD_EN=1;
LCD_Delay();
_LCD_EN=0;
LCD_Delay();
pBuffer++;
}
}
|
|