这两天在自己调程序,发现程序不按照预期的去执行,在判断后会跳到未执行的子函数中,不明白是什么情况。
贴出有关的代码:
- void main()
- {
- lcd_init();
- Uart_Init();
- Key_Init();
- clear_();
- delay(100);
- while(1)
- {
- cod_ = key_scan();//判断以及编码
- num_ = encode(cod_);//解码程序。得出数字
- if(num_!=16)
- {
- if(num_==3)
- {
- key();
- }
- if(num_==7)
- {
- iccade();
- }
- if(num_==11)
- {
- AS_608();
- }
- }
- }
-
- }
- 这是主函数。num==3,正常跳到指定函数,num==7会跳到非指定函数,按照正常来说会进入iccade()函数,但是会进到FPM10A_Add_Fingerprint()函数中。
- void iccade()
- {
- unsigned char status,i,j=0;
- unsigned char m=0,a,b,c;
- InitializeSystem( ); //中断初始化
- lcd_init();//lcd初始化
- PcdReset();//寻卡
- PcdAntennaOff();//关天线
- PcdAntennaOn();//开天线
- display();//显示初始化
- while ( 1 )
- {
- status = PcdRequest(0x52, g_ucTempbuf);//寻卡
- if (status != MI_OK)
- {
- InitializeSystem( );
- PcdReset();
- PcdAntennaOff();
- PcdAntennaOn();
- continue;
- }
- status = PcdAnticoll(g_ucTempbuf);//防冲撞
- if (status != MI_OK)
- { continue; }
- lcd_wcmd(0x01);
- delay(10);
- lcd_pos(0,0);
- for(i=0;i<4;i++)
- {
- a=g_ucTempbuf[i];
- b=a/16;
- c=a%16;
- data6[i*2]=table[b];
- delay(10);
- data6[i*2+1]=table[c];
- }
- for(i=0;i<8;i++)
- {
- if(ICpw[i]==data6[i])
- {
- if(i==7)
- {
- same();
- delay(1000);
- lcd_wcmd(0x01);
- display();
- break;
- }
- continue;
- }
- else
- diff_();
- delay(500);
- lcd_wcmd(0x01);
- display();
- break;
- }
- }
- }
- void FPM10A_Add_Fingerprint()
- {
- unsigned char id_show[]={0,0,0};
- lcd_wcmd(0x01); //清屏
- finger_id=0;
- while(1)
- {
- LCD1602_Display(0x80," Add finger ",0,16);
- LCD1602_Display(0xc0," ID is ",0,16);
- //按返回键直接回到主菜单
- if(KEY_CANCEL == 0)
- {
- while(KEY_CANCEL==0);
- break;
- }
- 当num==11时,执行woshou()函数时,显示完"Loading"后又会跳到FPM10A_Add_Fingerprint()函数,按下返回键才会回到woshou()函数继续执行。
- void AS_608()
- {
- lcd_wcmd(0x01);
- LCD1602_Display(0x80,"Fingerprint Test",0,16);
- delay(500);
- WoShou();
- delay(1000);
- while(1)
- {
- void WoShou()//握手指令
- {
- char i;
- LCD1602_Display(0xc0,"Loading",0,7); //设备加载中界面
- for(i=0;i<8;i++) //进度条式更新,看起来美观
- {
- lcd_wdat(42); //42对应ASIC码的 *
- delay(200); //控制进度条速度
- }
-
- FPM10A_Cmd_Check();
- FPM10A_Receive_Data(12);
- if(FPM10A_RECEICE_BUFFER[9]==0);
- LCD1602_Display(0xc0,"Docking success",0,16);
- delay(100);
-
-
- }
复制代码
贴出有关函数的代码 ,求各位大佬告知是什么情况。
|