《紧急关闭及处理》由会员分享,可在线阅读,更多相关《紧急关闭及处理(18页珍藏版)》请在金锄头文库上搜索。
1、紧急关闭及处理紧急关闭及处理#include#include#define uchar unsigned char#define uint unsigned intuchar code tab_seg17=/共阳数码管显示数字表 0x3F,0x06,0x5B,0x4F,/0 1 2 30x66,0x6D,0x7D,0x07, /4 5 6 7 0x7F,0x6F,0x77,0x7c,/8 9 A b0x39,0x5e,0x5c,0x71,0x73; /C,d,O,F,Puchar code tab_dis4=/段位显示表0xfe,0xfd,0xfb,0xf7;/0x07,0x0b,0x0d,0
2、x0e;uchar code tab_passinit4=1,2,3,4;uchar data tab_password4=0;uchar data tab_passbuff4=0;uchar code tab_emergency4=3,2,3,1;/紧急处理密码|万能密码uchar data tab_emergbuff4=0;sbit ds_595=P25; /设定 595 的串行输入、移位寄存器时钟及数据锁存器时钟;sbit stcp_595=P26;sbit shcp_595=P27;sbit SDA_PIN=P21;/设定 24C02 的数据、时钟端口sbit SCL_PIN=P20;
3、sbit A0=ACC0;sbit A7=ACC7;sbit speak=P35;bit flag_P;/闪烁位bit flagenter;bit flagok;bit flagres;bit flagset;/从设密码uchar num=16,count,dela,restrict,key,new,shutdown,countshut;void Delay1ms(uchar count) /延迟函数,参数为毫秒数unsigned char i,j;for(i=0;i4) count=4;if(countshut4) countshut=4;if(num=10)flagres=0;/限时标志/if(count!=0)/防止密码设为 0 时,按 enter 键即是输入密码flagenter=1;/enter 键按下标志count=0;/清除密码显示countshut=0;if(flagset=1) new+;elseRead_Im(0x00,tab_password);/读出 24C02 的存储密码/*for(i=0;i3) shutdown=3;Display_error();else if(flagset=1)Display_set();elseDisplay();