/********************输入指令函数********************/
void write_com(unsigned char com)
{
rs1602=0;
rw1602=0;
e1602=0;
P0=com;
e1602=1;
delay(1);
e1602=0;
}
/********************输入数字函数********************/
void write_date(unsigned char date)
{
rs1602=1;
rw1602=0;
e1602=0;
P0=date;
delay(1);
e1602=1;
delay(5);
e1602=0;
}
/********************初始化********************/
void clear()
{
rs1602=0;
rw1602=0;
e1602=0;
P0=0;
write_com(0x38);
delay(5);
write_com(0x0c);
delay(5);
write_com(0x06);
delay(5);
write_com(0x01);
delay(5);
}
/********************主函数********************/
void main()
{
clear();
write_date('a');
while(1);
}
试试吧,,,,