标题: proteus学习单片机1-Blink [打印本页]

作者: hemoparrot    时间: 2018-3-30 15:58
标题: proteus学习单片机1-Blink
电路图

代码:
  1. #include <reg52.h>

  2. #define uchar unsigned char
  3. #define uint unsigned int

  4. sbit LED=P1^0;

  5. //延时
  6. void DelayMS(uint x)
  7. {
  8.         uchar i;
  9.         while(x--)
  10.         {
  11.                 for(i=0;i<120;i++);
  12.         }
  13. }
  14. void main()
  15. {
  16.         while(1)
  17.         {
  18.                 LED=~LED;
  19.                 DelayMS(150);
  20.         }
  21. }
复制代码








欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1