1、 /rs-PD4 /rw-PD5 /en-PD6 /data-PORTB /SDA-PC1 /SCL-PC0 /beep-PA6 /开锁 -PB7 /开锁状态 -PB5 /如果把 uchar const initpassword6=0,0,0,0,0,0;改为 _flash uchar initpassword6=0,0,0,0,0,0; /则出现这错误 found unsigned expecting ;可我没找到错误在哪? ? #include #include #include #include #include #define uchar unsigned char #define u
2、int unsigned int #define w 6 /定义密码位数 uchar operation=0; /操作标志位 uchar pass=0; /密码正确标志 uchar ReInputEn=0; /重置输入充许标志 uchar s3_keydown=0; /3 秒按键标志位 uchar key_disable=0; /锁定键盘标志 uchar countt0,second; /t1 中断计数器 ,秒计数器 /void Delay5Ms(void); uchar InputData6; /输入密码暂存区 uchar CurrentPassword6=1,3,1,4,2,0; /当前密
3、码值 uchar TempPassword6; uchar N=0; /密码输入位数记数 uchar ErrorCont; /错误次数计数 uchar CorrectCont; /正确输入计数 uchar ReInputCont; /重新输入计数 #pragma data:code uchar const a=0xFE,0xFD,0xFB,0xF7; /控盘扫描控制表 uchar const start_line = “password: “; uchar const name = “=Coded Lock=“; /显示名称 uchar const Correct = “ correct “;
4、 /输入正确 uchar const Error = “ error “; /输入错误 uchar const codepass = “ pass “; uchar const LockOpen = “ open “; /OPEN uchar const SetNew = “SetNewWordEnable“; uchar const Input = “input: “; /INPUT uchar const ResetOK = “ResetPasswordOK “; uchar const initword = “Init password.“; uchar const Er_try = “
5、error,try again!“; uchar const again = “input again “; uchar const initpassword6=0,0,0,0,0,0; /*/ void port_init() DDRA|=BIT(6); PORTA|=BIT(6); DDRB=0xFF; PORTB=0xFF; DDRC=0xFF; PORTC=0xFF; /*/ void segg()/关数码显示管函数 DDRA|=BIT(PA3); /PA3 设置为输出状态 DDRA|=BIT(PA4); /PA4 设置为输出状态 DDRB=0xff; /PB 口设置为输出状态 POR
6、TB=0xff; /发送模 码 PORTA|=BIT(PA3); /PA3 输出高电平, DU拉高 PORTA /PA3 输出低电平, DU拉低,段选锁存 PORTB=0xff; /发送为选 关掉数码管显示 PORTA|=BIT(PA4); /PA4 输出高电平, WE拉高 PORTA /PA4 输出低电平, WE拉低,位选锁存 DDRA|=BIT(PA2); /PA2 设置为输出状态 用于 LED 流水灯控制 IO口 PORTA /PA2 输出低电平, DU拉低,段选 LED流水灯锁存 /*5ms延时 */ void Delay5Ms(void) uint TempCyc = 5552; while(TempCyc-); /*400ms 延时 */ void Delay400Ms(void) uchar TempCycA = 5; uint TempCycB; while(TempCycA-) TempCycB=7269; while(TempCycB-); /*24C02*/ void mDelay(uint t) /延时 uchar i; while(t-) for(i=0;i0;x-)