- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
自带程序(Built-in program)
自带程序(Built-in program)
6.4 traffic lights program
/***********************************************************
Intersection traffic lights control C program
***********************************************************/
#include reg51.h
#define uchar unsigned char
#define uint unsigned int
/***** definition control *******************************************/
Sbit Time_Show_LED2=P2^5; //Time_Show_LED2 (direct line time display) control bit
Sbit Time_Show_LED1=P2^4; //Time_Show_LED1 (direct line time display) control bit
Sbit EW_LED2=P2^3; //EW_LED2 control bit
Sbit EW_LED1=P2^2; //EW_LED1 control bit
Sbit SN_LED2=P2^1; //SN_LED2 control bit
Sbit SN_LED1=P2^0; //SN_LED1 control bit
Sbit SN_Yellow=P1^6; //SN yellow light
Sbit EW_Yellow=P1^2; //EW yellow light
Sbit EW_ManGreen=P3^0; //EW sidewalk green light
Sbit SN_ManGreen=P3^1; //SN sidewalk green light
Sbit Special_LED=P2^6; / / traffic lights
Sbit Busy_LED=P2^7; / / traffic lights
Sbit Nomor_Button=P3^5; / / normal traffic button
Sbit Busy_Btton=P3^6; / / busy button
Sbit Special_Btton=P3^7; / / special key traffic
Sbit EW_ManRed=P3^3; //EW sidewalk red light
Sbit SN_ManRed=P3^4; //SN sidewalk red light
Bit Flag_SN_Yellow; //SN yellow light flag bit
Bit Flag_EW_Yellow; //EW yellow light flag bit
Char Time_EW; / / west direction countdown unit
Char Time_SN; / / south direction countdown unit
Uchar EW=60, SN=40, EWL=19, SNL=19; / / initialize assignment, normal mode
Uchar EW1=60, SN1=40, EWL1=19, SNL1=19; / / for modifying the value of variables
Uchar, code, table[10]={0x3F, 0x06,0x5B, 0x4F, 0x66,0x6D, 0x7D, 0x07,0x7F, 0x6F}, //0-9 segment code
Uchar code S[8]={0x28,0x48,0x18,0x48,0x82,0x84,0x81,0x84};
/ / traffic lights control code
/********************** delay subroutine **************************/
Void Delay (uchar a)
{
Uchar i;
I=a;
While (i--) {}
}
/***************** display function ******************************/
Void Display (void)
{
Uchar, h, l;
H=Time_EW/10;
L=Time_EW%10;
P0=table[l];
EW_LED2=1; / / EW_LED2
您可能关注的文档
- 电算化1(Computerized 1).doc
- 电算化流程(Computerized process).doc
- 电缆工程工程量计算规则(Rules for calculation of quantities of cable engineering).doc
- 电脑主板电容好坏测量以及电容替换介绍(Computer motherboard capacitance measurement and capacitor replacement introduced).doc
- 电能计量中心集约化(Intensification of electric energy metering center).doc
- 电缆导体截面积与载流量的计算及截面的优化选择(Calculation of sectional area and Ampacity of cable conductor and optimum selection of cross section).doc
- 电脑主机前面的耳麦插口没声音了(The host computer in front of the headset jack no sound).doc
- 电线电缆知识30问答(Wire & cable knowledge 30 Q & A).doc
- 电脑在关机时自动清理垃圾文件(The computer automatically clean the junk files when it is turned off).doc
- 电气初试科目(Electrical preliminary examination).doc
- 自早盘高点回落(Down from early high).doc
- 自然美销售下滑店门缩量 独特加盟模式被质疑(Sales decline of natural beauty shop franchise model is unique Suoliang questioned).doc
- 自润滑轴承(Self-lubricating bearing).doc
- 自考2008年4月计算机网络原理试题与答案(Computer network principle examination questions and answers from April 2008).doc
- 自考-电大毕业论文毕业论文格式下载(Graduation form of graduation thesis of TV University graduation thesis).doc
- 自己总结ccd算法(I summarize the CCD algorithm).doc
- 自考历年领导科学案例题汇总(Summary of leading scientific cases in China).doc
- 自考国际商务谈判资料串讲(Data from the international business negotiations Chuanjiang).doc
- 自考资料文本文档(Self examination data text document).doc
- 自行创业有什么策管理略 (What are the management strategies for self employment).doc
文档评论(0)