本帖最后由 han001 于 2017-6-12 19:29 编辑
void main()//固定界面显示
{
TH0=(65536-46080)/256;
TL0=(65536-46080)%256; //50ms定时
ET0=1;
EA=1;
lcd_busy();
delay1ms(10);
lcd_init();
lcd_pos(0,0);//智能控制
i=0;
while(dis0!='\0')
{
write_dat(dis0);
i++;
}
lcd_pos(1,0);//当前水温
i=0;
while(dis2!='\0')
{
write_dat(dis2);
i++;
}
lcd_pos(2,0);//当前水位比
i=0;
while(dis3!='\0')
{
write_dat(dis3);
i++;
}
lcd_pos(3,0);//当前功能显示区
i=0;
while(dis1!='\0')
{
write_dat(dis1);
i++;
}
delay1ms(10);
while(1)
{
/*if(Low==1)
{
LOW=1;
}
else if(Low==0)
{
LOW=0;
}
else
{
LOW=2;
}*/
if(Low==0)//触发模拟自动上水
{
TR0=1;//开中断
write_cmd(0x01);
delay1ms(5);
delay(20);
lcd_pos(0,0);
i=0;
while(dis0!='\0')
{
write_dat(dis0);
i++;
}
delay(20);
lcd_pos(1,0);
i=0;
while(dis6!='\0')
{
write_dat(dis6);
i++;
}
delay(20);
lcd_pos(2,0);
i=0;
while(dis13!='\0')
{
write_dat(dis13);
i++;
}
if(water1<=water0)//判断是否上水完毕
{
lcd_pos(2,6);
write_sfm1(6,water1);
write_cmd(0x90);
m=0xfe;
P1=m;
delay1ms(500); //延时
m=_crol_(m,1);
}
else if(water1>water0)
{
TR0=0;//关中断
write_cmd(0x01);
delay1ms(5);
delay(20);
lcd_pos(0,0);
i=0;
while(dis0!='\0')
{
write_dat(dis0);
i++;
}
delay(20);
lcd_pos(1,0);
i=0;
while(dis4!='\0')
{
write_dat(dis4);
i++;
}
delay(20);
lcd_pos(2,0);
i=0;
while(dis13!='\0')
{
write_dat(dis13);
i++;
}
lcd_pos(2,6);
write_sfm1(6,water0);
write_cmd(0x90);
delay(20);
lcd_pos(3,0);
i=0;
while(dis1!='\0')
{
write_dat(dis1);
i++;
}
}
delay(20);
lcd_pos(3,0);
i=0;
while(dis7!='\0')
{
write_dat(dis7);
i++;
}
}
else if(Low==1)//未触发
{
write_cmd(0x01);
delay1ms(5);
delay(20);
lcd_pos(0,0);
i=0;
while(dis0!='\0')
{
write_dat(dis0);
i++;
}
delay(20);
lcd_pos(1,0);
i=0;
while(dis2!='\0')
{
write_dat(dis2);
i++;
}
delay(20);
lcd_pos(2,0);
i=0;
while(dis13!='\0')
{
write_dat(dis13);
i++;
}
lcd_pos(2,6);
write_sfm1(6,water0);
write_cmd(0x90);
delay(20);
lcd_pos(3,0);
i=0;
while(dis1!='\0')
{
write_dat(dis1);
i++;
}
}
keyscan();
}
}
void delay1ms(uint x)//延时
{
uint i,j;
for(j=0;j<x;j++)
for(i=0;i<110;i++);
}
void delay(uchar i)//延时
{
uchar j,k;
for(j=i;j>0;j--)
for(k=125;k>0;k--);
} |