基于单片机的交通灯系统设计(程序)

关注【电子开发圈】微信公众号,一起学习吧!

电子DIY、Arduino、51单片机、STM32单片机、FPGA……
电子百科、开发技术、职业经验、趣味知识、科技头条、设备拆机……

点击链接,免费下载100G+电子设计学习资料!

http://mp.weixin.qq.com/mp/homepage?__biz=MzU3OTczMzk5Mg==&hid=7&sn=ad5d5d0f15df84f4a92ebf72f88d4ee8&scene=18#wechat_redirect

----------------------------------------------------------------------------------------------------------------------------------

 

#include
#define uchar unsigned char
#define uint unsigned int

sbit FMQ=P3^4;
sbit QR=P2^7;
sbit QY=P2^6;
sbit QG=P2^5;
sbit HR=P2^7;
sbit HY=P2^6;
sbit HG=P2^5;
sbit ZR=P2^4;
sbit ZY=P2^3;
sbit ZG=P2^2;
sbit YR=P2^4;
sbit YY=P2^3;
sbit YG=P2^2;
sbit SWITCH1=P1^0;
sbit SWITCH2=P1^1;
sbit SWITCH3=P1^2;
sbit SWITCH4=P1^3;
sbit P3_2=P3^2;
sbit P3_3=P3^3;
uchar DAT1,DAT2;			   //显示时间变量
uchar DISP1[2]={0,0};		   //显示缓冲区1,南北
uchar DISP2[2]={0,0};		   //显示缓冲区2,东西
uchar code table[]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90,0xFF};

void DISPCLK1(uchar i);
void DISPCLK2(uchar i);

void DEL1MS(uint z)
{
    uint x,y;
	for(x=0;x

 

你可能感兴趣的:(MCU51系统设计)