写入80+0x10向右以为24位
例如:码滚
#include
#define uint unsigned int
#define uchar unsigned char
sbit lcden=P3^4;
sbit lcdrs=P3^5;
uchar code table[]="hello everyone!";
uchar code table1[]="welcome to here!";
sbit dula=P2^6;
sbit wela=P2^7;
void delay(uchar xms)
{
uint i,j;
for(i=xms;i>0;i--)
for(j=110;j>桥升0;j--);
}
void init()
{
dula=0;
wela=0;
lcden=0;
}
void writ_com(uchar com)
{
lcdrs=0;
P0=com;
delay(5);
lcden=1;
delay(5);
lcden=0;
}
void writ_data(uchar data1)
{
lcdrs=1;
P0=data1;
delay(5);
lcden=1;
delay(5);
lcden=0;
}
void main()
{
uint i,j;
init();
writ_com(0x38);
writ_com(0x0c);
writ_com(0x06);
writ_com(0x01);
writ_com(0x80+0x10);
for(i=0;i<15;i++)
{
writ_data(table[i]);
delay(5);
}
writ_com(0x80+0x50);
for(j=0;j<16;j++)
{
writ_data(table1[j]);
delay(8);
}
for(i=0;i<24;i++)//移位迟消余24
{
writ_com(0x1c);
delay(200);
}
while(1);
}