- 1、本文档共5页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
#include reg51.h
#define GPIO_PLACE P1
#define GPIO_DIG P0
void Delay10ms(unsigned int);
void DigDisplay();
unsigned char code DIG_PLACE[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
unsigned char code DIG_CODE[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07, 0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
unsigned char DisplayData[8];
//unsigned char emergency = 0; // 0 无特殊情况 1 有特殊情况发生
sbit K1_R=P2^0;
sbit K1_Y=P2^1;
sbit K1_G=P2^2;
sbit K2_R=P2^5;
sbit K2_Y=P2^4;
sbit K2_G=P2^3;
unsigned char b=1,c,Second,Time;
void main()
{
TMOD = 0x01; //定时器0选择工作方式1
TH0 = 0x3C; //设置初始值,定时50MS
TL0 = 0xB0;
ET0 = 1; //打开定时器0中断
EX0 =1; //INT0中断开
EA = 1; //打开总中断
IP =0X02; //INT0优先级高
TR0 = 1; //启动T0
IT0 =1; //INT0下降沿触发
while(1)
{
Second = 1;
for(c=0;c4;c++)
{
switch(b)
{
case 1:
for(;Second41;)
{
DisplayData[0] = 0x00;
DisplayData[1] = 0x00;
DisplayData[2] = DIG_CODE[(41 - Second) % 100 / 10];
DisplayData[3] = DIG_CODE[(41 - Second) %10];
DisplayData[4] = 0x00;
DisplayData[5] = 0x00;
DisplayData[6] = DisplayData[2];
DisplayData[7] = DisplayData[3];
K1_G=0;
K1_R=1;
K1_Y=1;
K2_G=1;
K2_R=0;
K2_Y=1;
DigDisplay();
}
b=2;
break;
case 2:
for(;Second44;)
{
DisplayData[0] = 0x00;
DisplayData[1] = 0x00;
DisplayData[2] = DIG_CODE[(44 - Second) % 100 / 10];
DisplayData[3] = DIG_CODE[(44 - Second) %10];
DisplayData[4] = 0x00;
DisplayData[5] = 0x00;
DisplayData[6] = DIG_CODE[(61 - Second) % 100 / 10];
DisplayData[7] = DIG_CODE[(61 - Second) %10];
DigDisplay();
K1_G=1;
K2_R=1;
K2_G=0;
K1_Y=0;
}
b=3;
break;
case 3:
for(;Second61;)
{
DisplayData[0] = 0x00;
DisplayData[1] = 0x00;
DisplayData[2] = DIG_CODE[(64 - Second) % 100 / 10];
DisplayData[3] = DIG_CODE[(64 - Second) %10];
DisplayData[4] = 0x00;
DisplayData[5] = 0x00;
DisplayData[6] = DIG_
您可能关注的文档
- 一种基于集成光学声光可调谐波器的红外光谱仪刘康2012202120048.doc
- 一轮复习试题商周时期的政治制度和秦朝中央集权制度的形成.doc
- 【北师大版】高中数学必修一教学设计方案.doc
- 三供一业分离移交文书某煤业集团移交办社会职能(三供一业)政策问答(宣传手册).doc
- 一年级语文上册期中考试试卷合集(共8套).doc
- 七年地理上册复习题纲.doc
- 三大控制系统的产生定义特点应用及发展趋势.doc
- 三级心理咨询师简答题重要考点.doc
- 三资台账样表.doc
- 三重一大集体决策制度实施办法.doc
- 新世纪评级-2024年上半年融资租赁行业信用观察.docx
- 粉丝尼尔森关于西班牙裔媒体消费和体育参与的游戏手册 Fanáticos Nielsen’s playbook on Hispanic audiences, sports and media engagement.docx
- 中国科学技术信息研究所:2024中国科技论文统计报告.docx
- 中国奶业经济月报2024年09月.docx
- 小红书 -乘风造势:女性护理双11营销解码全指南2024_部分1.docx
- 西窗科技:2024年海外婚纱礼服市场洞察报告 -婚纱礼服选品指南带你把握甜蜜经济.docx
- 2024年中国人才发展现代化指数.docx
- 2024 云栖大会微服务和网关相关演讲材料.docx
- 房地产 -毛坯房交付标准及品质提升方案.docx
- 房地产 -2024年一建管理《红宝书》 -建设工程项目管理历年真题解析及预测.docx
文档评论(0)