51单片机12864液晶屏显示代码如下,程序调试没问题了,但是有个疑问求高人解答,显示用户自定义字符中,LCD_WriteData(0);是什么意思?为什么写了两个同样的语句才能调试正常,写一个却显示不出笑脸?
请高手看完程序解答以下两个问题:1、LCD_WriteData(0);在这里是什么意思?
2、为什么重复写两次LCD_WriteData(0);语句,才能显示出笑脸
希望有人指点一下,感激不尽!
代码如下:
#include
***it RS=P2^4;
***it RW=P2^5;
***it EN=P2^6;
***it PSB=P2^1;
***it RST=P2^3;
#define DataPort P0
#define RS_CLR RS=0
#define RS_SET RS=1
#define RW_CLR RW=0
#define RW_SET RW=1
#define EN_CLR EN=0
#define EN_SET EN=1
unsigned char code SmileFace16x16[]={ //笑脸图片
0x0F,0xF0,0x10,0x08,0x20,0x04,0x40,0x02,0x9C,0x39,0xBE,0x7D,0x80,0x01,0x80,0x01,
0x80,0x01,0x88,0x11,0x84,0x21,0x43,0xC2,0x20,0x04,0x10,0x08,0x0F,0xF0,0x00,0x00,
};
void delayUS(unsigned char z)
{
while(--z);
}
void delayMS(unsigned char z)
{
while(z--)
{
delayUS(245);
delayUS(245);
}
}
void BF_Check()
{
RS_CLR;
RW_SET;
EN_SET;
DataPort=0xff;
while((DataPort&0x80)==0x80);
EN_CLR;
}
void LCD_WriteCmd(unsigned char Cmd)
{
BF_Check();
RS_CLR;
delayUS(5);
RW_CLR;
delayUS(5);
EN_SET;
delayUS(5);
DataPort=Cmd;
delayUS(5);
EN_CLR;
}
void LCD_WriteData(unsigned char Data)
{
BF_Check();
RS_SET;
delayUS(5);
RW_CLR;
delayUS(5);
EN_SET;
delayUS(5);
DataPort=Data;
delayUS(5);
EN_CLR;
}
void LCD_WriteString(unsigned char x,unsigned char y,unsigned char *String)
{
switch(y)
{
case 1: LCD_WriteCmd(0x80+x); break;
case 2: LCD_WriteCmd(0x90+x); break;
case 3: LCD_WriteCmd(0x88+x); break;
case 4: LCD_WriteCmd(0x98+x); break;
default: break;
}
while(*String!=' |