標(biāo)題: 簡(jiǎn)易的單片機(jī)交通燈proteus仿真及源碼 原理圖 [打印本頁(yè)]

作者: 51黑ff    時(shí)間: 2016-10-10 16:26
標(biāo)題: 簡(jiǎn)易的單片機(jī)交通燈proteus仿真及源碼 原理圖
給51黑的朋友分享一個(gè)簡(jiǎn)單的交通燈,下面是原理圖:



單片機(jī)程序:
  1. #include<at89x51.h>
  2. void delay(int n)
  3. {int i=0,j;
  4. while(n--)
  5. {for(i=0;i<10;i++)
  6. {for(j=0;j<125;j++);
  7. }
  8. }
  9. }
  10. void main()
  11. {
  12. int a=0;
  13. P1=0x21;
  14. delay(30);
  15. while(1)
  16. {
  17. P1=0x24;
  18. delay(1200);
  19. for(a=0;a<8;a++)
  20. {P1=0x22;
  21. delay(30);
  22. P1=0x20;
  23. delay(30);
  24. }
  25. P1=0x09;
  26. delay(1200);
  27. for(a=0;a<8;a++)
  28. {P1=0x11;
  29. delay(30);
  30. P1=0x01;
  31. delay(30);}
  32. }
  33.    }
復(fù)制代碼



單片機(jī)交通燈仿真工程文件及所有完整程序等資料下載地址(壓縮包一共有45個(gè)單片機(jī)仿真,全部下載后找到第011個(gè)項(xiàng)目即可):
http://www.torrancerestoration.com/bbs/dpj-56298-1.html

作者: 13487086265    時(shí)間: 2020-3-30 13:50
程序不對(duì)!




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