资源预览内容
第1页 / 共5页
第2页 / 共5页
第3页 / 共5页
第4页 / 共5页
第5页 / 共5页
亲,该文档总共5页全部预览完了,如果喜欢就下载吧!
资源描述
/*更多内容继续上传*/ #include#define uchar unsigned char sbit NR=P22; sbit NY=P21; sbit NG=P20; sbit WR1=P23; sbit WY=P24; sbit WG=P25; sbit SR=P30; sbit SY=P31; sbit SG=P32; sbit ER=P35; sbit EY=P34; sbit EG=P33; uchar code display= 0xc0,0xf9,0xa4,0xb0,/共阳极数码管显示段码 0x99,0x92,0x82,0xf8, 0x80,0x90,0x88,0x83, 0xc6,0xa1,0x86,0x8e,; uchar s1=10,Time_count=0;uchar Flash_count=0;uchar Operation_Type=1;void scan() P0=displays1;void T0_Time()interrupt 1 TH0=(65535-50000)/256; TH0=(65535-50000)%256; switch(Operation_Type) case 1: ER=WR1=1; EY=WY=1; EG=WG=0; SR=NR=0; SY=NY=1; SG=NG=1;s1=Time_count/20 ; if(+Time_count!=200) return; Time_count=0; Operation_Type =2; break;case 2: if(+Time_count!=20) return; Time_count=0; EG=WG=1; EY=WY= WY;s1=Time_count/20 ; if(+Flash_count!=10)/闪烁5次 return; Flash_count=0; Operation_Type =3; break; case 3: ER=WR1=0; EY=WY=1; EG=WG=1; SR=NR=1; SY=NY=1; SG=NG=0;s1=Time_count/20 ; if(+Time_count!=200) return; Time_count=0; Operation_Type =4; break; case 4: if(+Time_count!=20) return; Time_count=0; NY=SY=NY; NG=SG=1; s1=Time_count/20; if(+Flash_count!=10) return; Flash_count=0; Operation_Type =1; break; void main() TMOD=0x01; TH0=(65535-50000)/256; TL0=(65535-50000)%256; EA=1; ET0=1; TR0=1;while(1) scan();
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号