欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標題: 單片機LED數碼管顯示總結與源碼等 [打印本頁]

作者: 焦凱    時間: 2018-4-11 20:35
標題: 單片機LED數碼管顯示總結與源碼等
四、    實驗總結:
雖然這次的上級實驗不難,但是還有點小問題,中間有一些的代碼出現了一些錯誤,還是課本上的一些沒有記清楚,導致寫的時候出現了好幾個錯誤,由此可知還是看書看的太少,以后得多看看書,然后多做一些實驗練習練習。


二、程序設計流程圖


單片機源程序如下:
  1. #include<reg51.H>
  2. sbit P3_2=P3^2;
  3. sbit P3_3=P3^3;
  4. unsigned char  code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};//共陰LED段碼表
  5. unsigned char count=0;
  6. void delay(unsigned int time){//延遲函數
  7. unsigned int j=0;
  8. for(;time>0;time--)
  9. for(j=0;j<125;j--);
  10. }
  11. void main(void){
  12. count=0;
  13. P1=table[count/10];
  14. P2=table[count%10];
  15. while(1){
  16. if(P3_2==0){
  17. delay(10);
  18. if(P3_2==0){
  19. count++;
  20. if(count==100)
  21. count=0;//滿一百歸零
  22. P1=table[count/10];
  23. P2=table[count%10];
  24. while(P3_2==0);
  25. }
  26. }
  27. if(P3_3==0){
  28. delay(10);
  29. if(P3_3==0){
  30. count--;
  31. if(count==-1)
  32. count=99;
  33. P1=table[count/10];
  34. P2=table[count%10];
  35. while(P3_3==0);
  36. }
  37. }
  38. }
  39. }
復制代碼

所有資料51hei提供下載:
LED數碼顯示.docx (73.18 KB, 下載次數: 9)







歡迎光臨 (http://www.raoushi.com/bbs/) Powered by Discuz! X3.1