uchar code str1[]="aaaaaaaaaaaa"; uchar code str2[]="bbbbbbbbbbbb"; uchar code str3[]="cccccccccccc"; uchar code str4[]="dddddddddddd"; sbit KEY1=P1^1; sbit KEY2=P1^2; main() { uchar stat=1; lcd_init(); while(1) { switch(stat) { case 1:lcd_write_string(str1); if(KEY1==0){while(KEY1==0);stat=2;} if(KEY2==0){while(KEY2==0);stat=1;} break; case 2:lcd_write_string(str2); if(KEY1==0){while(KEY1==0);stat=3;} if(KEY2==0){while(KEY2==0);stat=1;} break; case 3:lcd_write_string(str3); if(KEY1==0){while(KEY1==0);stat=4;} if(KEY2==0){while(KEY2==0);stat=2;} break; case 4:lcd_write_string(str4); if(KEY1==0){while(KEY1==0);stat=1;} if(KEY2==0){while(KEY2==0);stat=3;} break; default:break;
} } } 按KEY1,KEY2 是能实现上下翻显示,但显示不稳,不停的闪,如何解决?
|