啥叫不行?不顯示?沒反應?顯示不如預期?
LCD1602不用刷的那么頻繁
數據有更新才去刷新
固定字符更不用重新寫入
可參考以下代碼
- #include <STC89C5xRC.H>
- #include "DElay.h"
- #include "LCD1602.h"
- sbit K1=P2^7;
- sbit K2=P2^6;
- void main()
- {
- int SDT=100;
- LCD_Init();
- LCD_ShowChar(2,12,0xDF);
- LCD_ShowString(2,13,"C");
- while (1)
- {
- if(K1==0)
- {
- Delay(20);
- while(K1==0);
- Delay(20);
- SDT=SDT+10;
- LCD_ShowNum(2,9,SDT,3);
- }
- if(K2==0)
- {
- Delay(20);
- while(K2==0);
- Delay(20);
- SDT=SDT-10;
- LCD_ShowNum(2,9,SDT,3);
- }
- }
- }
復制代碼 |