標(biāo)題: 模擬花樣廣告燈顯示實(shí)驗(yàn) [打印本頁(yè)]

作者: liuda    時(shí)間: 2015-1-21 23:10
標(biāo)題: 模擬花樣廣告燈顯示實(shí)驗(yàn)
是用51hei單片機(jī)開(kāi)發(fā)板 電路圖詳見(jiàn):http://www.torrancerestoration.com/f/51hei-5.pdf   p1口上面接8個(gè)燈.

  1. #include<reg52.h>
  2. #define uchar unsigned char
  3. #define uint unsigned int
  4. uchar code LED1[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};
  5. uchar code LED2[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
  6. uchar code LED3[]={0x7e,0xbd,0xdb,0xe7,0xe7,0xdb,0xbd,0x7e};
  7. uchar code LED4[]={0x7f,0x3f,0x1f,0x0f,0x07,0x03,0x01,0x00};
  8. uchar code LED5[]={0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00};
  9. //============
  10. void delay(unsigned int k)
  11. {
  12. unsigned int i,j;
  13. for(i=0;i<k;i++){
  14. for(j=0;j<121;j++)
  15. {;}}
  16. }
  17. //====================
  18. void main(void)
  19. {uchar cnt;
  20. while(1)
  21. {
  22. for(cnt=0;cnt<8;cnt++)
  23. {P1=LED1[cnt];
  24. delay(200);}
  25. //=======
  26. for(cnt=0;cnt<8;cnt++)
  27. {P1=LED2[cnt];
  28. delay(200);}
  29. //===========
  30. for(cnt=0;cnt<8;cnt++)
  31. {P1=LED3[cnt];
  32. delay(200);}
  33. //==========
  34. for(cnt=0;cnt<8;cnt++)
  35. {P1=LED4[cnt];
  36. delay(200);}
  37. //=========
  38. for(cnt=0;cnt<8;cnt++)
  39. {P1=LED5[cnt];
  40. delay(200);}
  41.     }
  42. }
復(fù)制代碼








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