sfr P1M0 = 0x92;
sfr P1M1 = 0x91;
sfr P3M0 = 0xB2;
sfr P3M1 = 0xB1;
sfr P5M1 = 0xC9;
sfr P5M0 = 0xCA;
sfr AUXR = 0x8e; //辅助寄存器
sfr P5=0xC8;
sbit CS=P3^5; //液晶屏
sbit SID=P3^6; //液晶屏
sbit CLK=P3^7; //液晶屏
////====延时函数=============================
void delay(uint ms) //12864液晶屏使用
{
uchar t;
while(ms--)
{
for(t=0;t<110;t++);
}
}
void main()
{
P1M0 = 0x00;
P1M1 = 0x0F; //P1.0高阻输入。作为ADC口,0x40;
P3M0 = 0x00; //
P3M1 = 0x00; //P3,准双向口
P5M0 = 0x00;
P5M1 = 0x00;
TN_itin(); //所有中断、定时器初始化
lcdinit(); //液晶屏初始化
key=0;
TB=0;
while (1);
{
lcd_pos(1,0); //第一行,第1位
hzkdis(dis1); //1输入
write_data(0x3A);
}
} |