#include<reg52.h>//包含头文件,一般情况不需要改动,
//头文件包含特殊功能寄存器的定义
sbit LACTCH1=P2^2;
sbit LACTCH2=P2^3;
/*------------------------------------------------
全局变量
------------------------------------------------*/
bit red,green,yellow,turnred;//定义红绿黄灯标志位
code unsigned char tab[]=
{0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
//共阴数码管 0-9
unsigned char Dis_Shiwei;//定义十位
unsigned char Dis_Gewei; //定义个位
/*------------------------------------------------
------------------------------------------------*/
void delay(unsigned int cnt)
{
while(--cnt);
}
/*------------------------------------------------
主程序
------------------------------------------------*/
main()
{
T
【51单片机】交通灯2
于 2024-03-03 11:30:38 首次发布