模拟仿真真实情景下交通信号灯的运转过程,内含C51工程与Proteus ISIS仿真程序。
2022-10-29 20:12:06 32KB 信号灯 Proteus交通灯
1
#include #define uchar unsigned char #define uint unsigned int unsigned char code ledChar[]= { 0xC0, 0xF9, 0xA4, 0xB0, 0x99, 0x92, 0x82, 0xF8, //CA数码管编码 0x80, 0x90, 0x88, 0x83, 0xC6, 0xA1, 0x86, 0x8E }; unsigned char ledBuff[2]= { 0xFF, 0xFF //初始化数码管 }; uint count=0; uint x=0; uint time1=15; uint time2=20; Ledshow() { if(x == 0) { if(time1 >=0) { P1 = 0x0c; } } if(x == 1) { if(time1>=0) { P1 = 0x0a; } } if(x == 2) { if(time1>=5) { P1 = 0x21; } if (time1=5) { P1 = 0x0A; } }*/ void delay(uint x) { uchar i; while(x--) for(i=0;i<120;i++); } void display() { ledBuff[0]=ledChar[time1/10]; ledBuff[1]=ledChar[time1]; P2=0x01; P0=ledBuff[0]; delay(1); P2=0x02; P0=ledBuff[1]; delay(1); ledBuff[0]=ledChar[time2/10]; ledBuff[1]=ledChar[time2]; P2=0x04; P0=ledBuff[0]; delay(1); P2=0x08; P0=ledBuff[1]; delay(1); Ledshow(); } void main() { TMOD=0x01; TH0=0x3C; TL0=0xb0; TR0=1; EA=1; ET0=1; while(1) { display(); } } void in_TR0() interrupt 1 { TH0=0x3c; //重新赋初值 TL0=0xb0; count++; if (count==20) //我们定义的是1ms中断,要一秒变化一次,让count加到1000 { count=0; //到1000后重新赋初值 time1--; time2--; if(x == 0 && time1 == 0) { time1=5; x = 1; } if(x == 1 && time1 == 0) { time1=20; time2=15; x = 2; } if(x == 2 && time1 ==5) { time2=5; x = 2; } if(x == 2 && time1 ==0) { time1=15; time2=20; x = 0; } } }
2021-06-11 21:11:54 56KB proteus 交通灯 c51
1
南昌大学软件学院,单片机课程设计 南昌大学软件学院,单片机课程设计 利用单片机的定时器产生秒信号,控制十字路口的红绿黄灯交替点亮和熄灭,并且用4只LED数码管显示十字路口两个方向的剩余时间。要求能用按键设置两个方向的通行时间(绿灯点亮的时间)和暂缓通行时间(黄灯点亮的时间),系统的工作符合一般交通灯控制要求
2019-12-21 22:01:10 99KB 交通灯 51 proteus仿真 PPT
1
基于8086cpu,利用proteus进行仿真,这是一个交通灯的示例,里面有proteus电路图和汇编代码文件
2019-12-21 20:43:37 53KB 8086 proteus 交通灯
1