再次求助!!!!!ch452l

调试ch452l,显示正常!按键响应正常!!只是键处理执行两次.例如:要按键控制某一位显示加一,但按键后显示却加二,其余键操作也是执行两次!!请高手指教!!帮助!!!谢谢! 

应该是程序问题吧,贴出来看看


/*--------------------------------*/ void int1() interrupt 2 using 1 { flag_in0=1;//按键标志 } /*---------------------------------*/ jianpan(void) { if(flag_in0==1) { flag_in0=0; aa=CH452_Read(); } } /*------------------------------------*/ void zhixing(void) { switch(aa) {case 0x40:aa=0; CH452_Write(CH452_DIG0 | 0); // 显示字符8 CH452_Write(CH452_LEFTCYC ); CH452_Write(CH452_DIG7 | 0); break; case 0x49:aa=0; CH452_Write(CH452_DIG0 | 6); // 显示字符8 CH452_Write(CH452_DIG1 | 6); CH452_Write(CH452_DIG2 | 6); CH452_Write(CH452_DIG3 | 6);;break; case 0x52:aa=0; t++;if(t>9)t=0;CH452_Write(CH452_DIG2 | t); break; case 0x5b:aa=0; CH452_Write(CH452_LEFTCYC ); break; case 0x64:aa=0; CH452_Write(CH452_RIGHTMOV);break; default:break; } } /*-------------主程序-----------------*/ main() { unsigned char cmd,dat,i; unsigned short command; init(); CH452_Write(CH452_SYSON2); CH452_Write(CH452_BCD); // BCD译码,8个数码管 CH452_Write(CH452_DIG0 | 8); // 显示字符8 CH452_Write(CH452_DIG1 | 7); CH452_Write(CH452_DIG2 | 6); CH452_Write(CH452_DIG3 | 5); CH452_Write(CH452_DIG4 | 4); CH452_Write(CH452_DIG5 | 3); CH452_Write(CH452_DIG6 | 2); CH452_Write(CH452_DIG7 | 1); /*CH452_Write(CH452_LEFTMOV);//整体左移 CH452_Write(CH452_LEFTCYC );//左循环移 CH452_Write(CH452_RIGHTMOV);//整体右移 CH452_Write(CH452_RIGHTCYC);//右循环*/ for(i=0;i<30;i++) while ( 1 ){ jianpan(); zhixing(); } }


init()函数呢,全部贴出来吧,或者可以发到技术部信箱;


只有登录才能回复,可以选择微信账号登录