#include//接口定义
//1602的数据接口为P0
sbit RSPIN = P2^0;
sbit RWPIN = P2^1;
sbit EPIN = P2^2;
unsigned char xdata shuzi[]={'0','1','2','3','4','5','6','7','8','9'};
/// 延时函数/
void delay(unsigned int t) //毫秒延时(用在延时不需很精确地情况下)
{ unsigned int xdata j;
while(--t){
for(j=600;j>0;j--);}
}
//下面的是1602的驱动
void testbusy(void)//判忙
{
P0=0xff;
RSPIN=0;
RWPIN=1;
_nop_();
_nop_();
EPIN=1;
while((P0&0x80)==0x80);
EPIN=0;
}
void lcdcmd(unsigned char c) //写入命令字符的底层操作
{
RSPIN=0;
RWPIN=0;
P0=c;
_nop_();
_nop_();
EPIN=1;
<