2行 5*8 16字符LCD显现方法的地址映射:
对应地址: 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07
D0-D7的值: 0x80 0x81 0x820x83 0x84 0x85 0x86 0x87
对应地址: 0x400x410x420x43 0x44 0x45 0x46 0x47
D0-D7的值: 0xC00xC10xC20xC3 0xC4 0xC5 0xC6 0xC7
代码完成(运用setDisplayPosition函数,第一个参数为字符也可为ASCII码,第二个为上面的D0-D7对应的值,想显现哪个方位,就放入哪个地址参数):
void delay(int x)//延时Xms
{
char y;
while(x–)
for(y=110;y>0;y–);
}
void write_date(char date)//写数据
{
lcdrs=1;
P0=date;
delay(5);
lcden=1;
delay(5);
lcden=0;
}
write_position(char date)
{
lcdrs=0;
lcdrw=0;
P0=position;
delay(5);
lcden=1;
delay(5);
lcden=0;
}
void setDisplayPosition(char date,char position)
{
write_position(position);
write_date(date);
}
声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/yingyong/5g/262929.html