摘要本次设计是对交通灯的模拟控制系统的设计,总体分为两部分:一、硬件部分。
对于硬件部分主要工作是选型部分,我的本次设计是交通灯,所以硬件选型主要有AT89C51、红绿灯显示器、及数码管显示器。
二、软件部分。
根据设计要求,所以将软件部分分成了几个模块:主体程序实现基本的循环,即主干道绿灯亮60S,黄灯5S;支干道绿灯亮40S黄灯5S;子程序有计时到一秒子程序、中断子程序(全为红灯、南北通行、东西通行、重新定时等)。
将上面个部分逐一实现后,然后就是硬件部分连接问题。
根据AT89C51单片机个端口的特点,将选好的部件有效地与它连接起来。
最后将编好的汇编程序转换为HEX 文件导入到单片机内,进行仿真。
经过反复修改及指导老师指导后,可以实现仿真。
关键词:交通灯;硬件部分;软件部分- 1 -AbstractThe designer to the traffic light simulation, the design of the control system of general divided into two parts: one, the hardware part. For hardware part of the main work is part of the selection, I this design is the traffic lights, so hardware selection mainly AT89C51, red street light display, digital tube display level. Second, software parts. According to the design requirements, so will be divided into several modules of software: subject to basic program of circulation, that is a green light to main 60 S, yellow light 5 S; A trunk road a green light yellow light 40 S, yellow light 5 S; The son to a second time program has a subroutine, interrupt subroutine (total for the red light, north and south, traffic to pass something, timing, etc.). Will above a part one by one to achieve, and then the hardware part is linking problem. According to the characteristics of a port AT89C51 single-chip microcomputer, taking good parts effectively with it together. Finally will be programmed the assembler program into: into single chip inside, files are simulated. After repeated modifying and guiding teacher, can achieve after simulation.Key words:The traffic lights; Hardware parts;Software part目录引言...................................................................................................................................... - 4 -第1章概述................................................................................................................................ - 5 -1.1单片机认识与应用....................................................................................................... - 5 -1.1.1单片机的认识................................................................................................... - 5 -1.1.2单片机的应用................................................................................................... - 5 -1.2设计任务....................................................................................................................... - 6 -第2章系统总体方案及硬件设计............................................................................................ - 7 -2.1交通管理的方案........................................................................................................... - 7 -2.2总体硬件设计............................................................................................................... - 8 -2.1系统时钟电路....................................................................................................... - 8 -2.2系统复位电路....................................................................................................... - 9 -2.2.3数码管显示电路............................................................................................. - 10 -2.2.4交通灯指示电路............................................................................................. - 12 -2.2.5按键电路设计................................................................................................. - 13 -第3章软件系统设计.............................................................................................................. - 15 -3.1设计思路..................................................................................................................... - 15 -3.2 软件设计.................................................................................................................... - 15 -3.2.1交通灯的设计程序说明................................................................................. - 16 -3.2.2计时到1秒检测............................................................................................. - 16 -3.2.3 交通灯显示.................................................................................................... - 17 -3.2.4全部禁行......................................................................................................... - 18 -3.2.5南北通行程序................................................................................................. - 19 -3.2.6东西通行程序................................................................................................. - 19 -3.2.7定时器0中断函数......................................................................................... - 20 -第4章Proteus软件仿真........................................................................................................ - 21 -4.1 Proteus软件仿真..................................................................................................... - 21 -4.1.1 南北交通灯切换时仿真................................................................................ - 21 -4.1.2 东西交通灯的仿真........................................................................................ - 22 -4.1.3东西交通灯切换的仿真................................................................................. - 23 -4.1.4两车道均为红灯的仿真................................................................................. - 23 -第5章心得体会.................................................................................................................. - 25 -致谢.................................................................................................................................... - 26 -参考文献.............................................................................................................................. - 27 -附1 源程序代码..................................................................................................................... - 28 -附2 交通灯设计原理图......................................................................................................... - 38 -- 3 -引言这次毕业设计就是利用单片机的基本特点,使用汇编语言实现一个模拟交通灯电路。