标题: 简易交通灯仿真和源代码 [打印本页]

作者: 小星是么    时间: 2018-8-27 14:29
标题: 简易交通灯仿真和源代码
include "reg51.h"
#include "intrins.h"
#define uc unsigned char
void delay2s(void)   //Îó2î 0us
{
    unsigned char a,b,c;
    for(c=127;c>0;c--)
        for(b=235;b>0;b--)
            for(a=32;a>0;a--);
    _nop_();  //if Keil,require use intrins.h
}

                                  
void main()                 
{
while(1)
{
   P2=0x01;
   delay2s();
   P2=0x02;
   delay2s();
   }
}include "reg51.h"
#include "intrins.h"
#define uc unsigned char
void delay2s(void)   //Îó2î 0us
{
    unsigned char a,b,c;
    for(c=127;c>0;c--)
        for(b=235;b>0;b--)
            for(a=32;a>0;a--);
    _nop_();  //if Keil,require use intrins.h
}

                                  
void main()                 
{
while(1)
{
   P2=0x01;
   delay2s();
   P2=0x02;
   delay2s();
   }
}

QQ浏览器截图20180827142537.png (45.88 KB, 下载次数: 26)

仿真电路

仿真电路

交通灯1.rar

28.72 KB, 下载次数: 8, 下载积分: 黑币 -5






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