proteus交通灯

上传者: guairl | 上传时间: 2021-06-11 21:11:54 | 文件大小: 56KB | 文件类型: RAR
#include #define uchar unsigned char #define uint unsigned int unsigned char code ledChar[]= { 0xC0, 0xF9, 0xA4, 0xB0, 0x99, 0x92, 0x82, 0xF8, //CA数码管编码 0x80, 0x90, 0x88, 0x83, 0xC6, 0xA1, 0x86, 0x8E }; unsigned char ledBuff[2]= { 0xFF, 0xFF //初始化数码管 }; uint count=0; uint x=0; uint time1=15; uint time2=20; Ledshow() { if(x == 0) { if(time1 >=0) { P1 = 0x0c; } } if(x == 1) { if(time1>=0) { P1 = 0x0a; } } if(x == 2) { if(time1>=5) { P1 = 0x21; } if (time1=5) { P1 = 0x0A; } }*/ void delay(uint x) { uchar i; while(x--) for(i=0;i<120;i++); } void display() { ledBuff[0]=ledChar[time1/10]; ledBuff[1]=ledChar[time1]; P2=0x01; P0=ledBuff[0]; delay(1); P2=0x02; P0=ledBuff[1]; delay(1); ledBuff[0]=ledChar[time2/10]; ledBuff[1]=ledChar[time2]; P2=0x04; P0=ledBuff[0]; delay(1); P2=0x08; P0=ledBuff[1]; delay(1); Ledshow(); } void main() { TMOD=0x01; TH0=0x3C; TL0=0xb0; TR0=1; EA=1; ET0=1; while(1) { display(); } } void in_TR0() interrupt 1 { TH0=0x3c; //重新赋初值 TL0=0xb0; count++; if (count==20) //我们定义的是1ms中断,要一秒变化一次,让count加到1000 { count=0; //到1000后重新赋初值 time1--; time2--; if(x == 0 && time1 == 0) { time1=5; x = 1; } if(x == 1 && time1 == 0) { time1=20; time2=15; x = 2; } if(x == 2 && time1 ==5) { time2=5; x = 2; } if(x == 2 && time1 ==0) { time1=15; time2=20; x = 0; } } }

文件下载

资源详情

[{"title":"( 17 个子文件 56KB ) proteus交通灯","children":[{"title":"交通灯","children":[{"title":"Traffic_light.plg <span style='color:#111;'> 8.33KB </span>","children":null,"spread":false},{"title":"NTB.DSN <span style='color:#111;'> 125.50KB </span>","children":null,"spread":false},{"title":"Last Loaded NTB.DBK <span style='color:#111;'> 127.99KB </span>","children":null,"spread":false},{"title":"STARTUP.LST <span style='color:#111;'> 11.39KB </span>","children":null,"spread":false},{"title":"Text1.c <span style='color:#111;'> 1.90KB </span>","children":null,"spread":false},{"title":"Traffic_light_Uv2.Bak <span style='color:#111;'> 0B </span>","children":null,"spread":false},{"title":"Traffic_light.lnp <span style='color:#111;'> 51B </span>","children":null,"spread":false},{"title":"Traffic_light.Uv2 <span style='color:#111;'> 2.01KB </span>","children":null,"spread":false},{"title":"Traffic_light <span style='color:#111;'> 5.42KB </span>","children":null,"spread":false},{"title":"Traffic_light.Opt <span style='color:#111;'> 1.10KB </span>","children":null,"spread":false},{"title":"Traffic_light.hex <span style='color:#111;'> 1.98KB </span>","children":null,"spread":false},{"title":"STARTUP.A51 <span style='color:#111;'> 5.00KB </span>","children":null,"spread":false},{"title":"Traffic_light.M51 <span style='color:#111;'> 9.14KB </span>","children":null,"spread":false},{"title":"Text1.OBJ <span style='color:#111;'> 5.84KB </span>","children":null,"spread":false},{"title":"Text1.LST <span style='color:#111;'> 6.10KB </span>","children":null,"spread":false},{"title":"STARTUP.OBJ <span style='color:#111;'> 749B </span>","children":null,"spread":false},{"title":"NTB.PWI <span style='color:#111;'> 1.05KB </span>","children":null,"spread":false}],"spread":false}],"spread":true}]

评论信息

  • alex_xlin :
    感谢,如果是汇编就更好了
    2017-12-11

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明