標(biāo)題: 單片機(jī)小實(shí)驗(yàn)四個(gè)數(shù)碼管滾動顯示(C程序和Ptotues電路圖) [打印本頁]

作者: wangjing123    時(shí)間: 2020-2-17 14:57
標(biāo)題: 單片機(jī)小實(shí)驗(yàn)四個(gè)數(shù)碼管滾動顯示(C程序和Ptotues電路圖)
51單片機(jī)實(shí)驗(yàn)仿真原理圖如下(proteus仿真工程文件可到本帖附件中下載)

程序源碼

  1. #include <reg51.h>
  2. typedef unsigned char uint8;
  3. typedef unsigned int uint16;
  4. code uint8 LED_CODE[] = {0xC0,0xF9,0xA4,0xB0};
  5. void delay(uint16 x)
  6. {
  7. uint16 i,j;
  8. for(i = x; i > 0; i --)
  9.   for(j = 114; j > 0; j --);  
  10. }
  11. void main()
  12. {
  13. uint8 i;
  14. while(1)
  15. {
  16.   for(i = 0; i < 4; i ++)
  17.   {
  18.    P3 = 0x01 << i;   
  19.    P0 = LED_CODE[ i];   delay(500);  } }}
復(fù)制代碼


_A6~`$ZA3O@7$])101)Y0Q9.png (56.57 KB, 下載次數(shù): 113)

_A6~`$ZA3O@7$])101)Y0Q9.png

4只數(shù)碼管滾動顯示0~3.zip

48.38 KB, 下載次數(shù): 31, 下載積分: 黑幣 -5






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