资源描述:
《Proteus实现单片机交通灯-图+程序(调试可用).doc》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、__________________________________________________这是我初学单片机,并用Proreus软件自己绘制自己编写程序实现的一个交通红绿灯的系统。这是硬件连接图和程序,以便今后复习。____________________________________________________________________________________________________左__________________________________________________
2、__________________________________________________上____________________________________________________________________________________________________右____________________________________________________________________________________________________下__________
3、__________________________________________________________________________________________中____________________________________________________________________________________________________控制部分,上面一个开关按下时,南北方向绿灯,东西方向红灯____________________________________________
4、____________________________________________________________________________________________________________________________________________________________黄灯闪烁3秒____________________________________________________________________________________________________绿
5、灯设置15秒,红灯设置18秒。绿灯走完15秒后黄灯闪烁3秒变为红灯,红灯走完18秒后变成绿灯,以此循环。源程序:COUNTEQU30H;T0中断计数SNLEDDATAEQU31H;存储南北数码管显示的数据SNCOLORFLAGEQU32H;=1时南北绿灯亮,=2时南北黄灯亮,=3时南北红灯亮SNLEDDATAINITEQU33H;存储南北各颜色灯的初始时间EWLEDDATAEQU34H;存储东西数码管显示的数据EWCOLORFLAGEQU35H;=1时东西红灯亮,=2时东西绿灯亮,=3时东西黄灯亮EWLEDDATAINI
6、TEQU36H;存储东西各颜色灯的初始时间org0000hlJMPMAINorg0003hljmpexint0ORG000BHlJMPINTT0org0013hljmpexint1org0100h;主函数**************************************MAIN:CALLINITSTART:MOVA,COUNTCJNEA,#200,NOT1S;没到1秒跳转MOVCOUNT,#00;1秒时间到_____________________________________________________
7、_______________________________________________DECSNLEDDATAMOVA,SNLEDDATAJNZcheckewleddataMOVSNLEDDATA,SNLEDDATAINITINCSNCOLORFLAGMOVA,SNCOLORFLAGCJNEA,#04,checkewleddataMOVSNCOLORFLAG,#01checkewleddata:DECEWLEDDATAMOVA,EWLEDDATAJNZtimenotoverMOVEWLEDDATA,EWLEDDA
8、TAINITINCEWCOLORFLAGMOVA,EWCOLORFLAGCJNEA,#04,timenotoverMOVEWCOLORFLAG,#01TIMENOTOVER:NOT1S:callewcolorcheckCALLsnCOLORCHECKCALLDISPLAYJMPSTART;**************