- 1、本文档共17页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
自带程序(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
- 导航八级上册华师版.pptx
- 产-英菲尼迪维修信息系统.pdf
- 诺基亚客户服务2115i 2116irh-66移动终端问题.pdf
- 混合方程工具箱v.pdf
- white matter degeneration in atypical alzheimer disease非典型阿尔茨海默氏病白质变性.pdf
- 行业应用工具答案sinamicsg sscripte for讲稿.pdf
- jmag申注释三相感应电动机扭矩分析考虑偏斜内容概述3jac039im-torque.pdf
- adi提供sharc相关应用笔记程序代码全集ee355.pdf
- 七级数学教学上册有理数乘法课件新人教版.pptx
- 广播设计形状线条red giant geomancy user guide.pdf
文档评论(0)