欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標題:
LCD模塊顯示,高手進~
[打印本頁]
作者:
samwalton
時間:
2012-3-11 00:00
標題:
LCD模塊顯示,高手進~
用一個外部中斷讀取編碼器圈數,用一個定時器實現30s倒計時,并將圈數和時間在LCD上顯示。程序編譯沒有問題,但LCD上出現跳動的亂碼,求高手幫幫忙呀~跪謝謝了~~ #include "lcd.h" #include "common.h" int degree=0; int time=35; int circle; unsigned char xdata countdown[2]; unsigned char xdata circlestr[2]; void main(void) { IT0=1; //外部中斷0下降沿觸發 EA=1; //全局中斷打開 EX0=1; //允許外部中斷0 TMOD|=0x01; //定時器0 16位定時器 X=65535-10000(10毫秒)=55535=D8F0(十六進制)定時10ms TH0=0xd8; //計數時間 TL0=0xf0; IE=0x82; //這里是中斷優先級控制EA=1(開總中斷),ET0=1(定時器0允許中斷),這里用定時器0來定時 TR0=1; //打開定時器0 circle=degree/360; //取圈數 circlestr[0]=circle/10+0x30; //取十位 circlestr[1]=circle%10+0x30; //取個位 countdown[0]=time/10+0x30; //取時間十位 countdown[1]=time%10+0x30; //取個位 LCD_Init( ); LCD_ClearScreen(); while( 1 ) { LCD_ShowDot6x8Str(48, 1, circlestr); //LCD顯示圈數 LCD_ShowDot6x8Str(48, 0, countdown); // LCD顯示倒計時30s } } void int0()interrupt 0 //外部中斷0 { EA=0; if(P3^3==0) degree++; else degree--; EA=1; } void tim(void) interrupt 1 using 1 //定時器0中斷 { int count; //99只是一個數,可以任意改,因為這里只學習怎樣實現倒計時 TH0=0xd8; //定時10毫秒 TL0=0xf0; count++; if(count==100) //10毫秒定時,10*100=1000(毫秒)=1秒 if(time>=0) time--; }
[此貼子已經被作者于2012-3-11 0:02:36編輯過]
作者:
fancommand
時間:
2012-3-11 10:29
怎么這么一塌糊涂? 如何看啊?
作者:
yanwo19840726
時間:
2012-3-16 14:36
lcd 清屏了嗎
歡迎光臨 (http://m.raoushi.com/bbs/)
Powered by Discuz! X3.1