|
1602显示后怎么使用了清屏还是清不了啊!急救!!!
[复制链接]
最近在做一个小实验,用DSB1802和1602和键盘来实现,处理器用52的单片机!可是在显示了之后我再按键盘没反映。复位后又只能显示我最先按下的键所对应的程序!急求帮忙啊!
程序如下,
//sbit E=P2^7; //1602使能引脚
sbit RW=P2^6; //1602读写引脚
sbit RS=P2^5; //1602数据/命令选择引脚//
void L1602_init(void) //1602的初始化程序
{
enable(0x01); //清屏
enable(0x38);
enable(0x0c);
enable(0x06);
enable(0xd0);
}
void main()
{
uint temp,key_value=7,n=10;//n是个数,key—value是初始时随便赋的值
P2 = 0x00; //这三个引脚参考资料
L1602_init();
L1602_string(1,1," please wait ");
P1 = 0xf0;
while(1)
{
key_value=keyscan();
P2 = 0x00;
L1602_init(); //本来想在进入选择的时候再初始化一下,可是当key_value为2的时候please wait
//还是不能 清 掉啊
while(key_value==1)
{ P2 = 0x00;
L1602_init();
L1602_string(1,1," please wait ");
L1602_string(2,1," wait..... ");
delay(5);
}
while(key_value==2)
{ P2 = 0x00;
L1602_init();
L1602_string(1,1," look the down ");
L1602_string(2,1,"Temperature:00`C");
Reset();
write_byte(jump_ROM);
write_byte(start);
Reset();
write_byte(jump_ROM);
write_byte(read_EEROM);
TMPL = read_byte();
TMPH = read_byte();
temp = TMPH;
temp <<= 8;
temp = temp | TMPL;
tt = TMPL * 0.0625;
temp = TMPL / 16 + TMPH * 16;
L1602_char(2,13,temp/10%10 + 48);
L1602_char(2,14,temp%10 + 48);
delay(100);
}
while(key_value==3)
{ P2 = 0x00;
L1602_init();
L1602_string(1,1," this is num ");
L1602_string(2,1,"the num =0");
L1602_char(2,10,n/10%10+48);
L1602_char(2,11,n%10+48);
delay(5);
}
}
}
|
|