void ad_con(void) { unsigned int acbuf; unsigned long acbuf0; if(ADCON0bits.GO==0) { acbuf=ADRES; if(acbuf<ZERO_SPEED_REF) { DesiredSpeed=0; } else if(acbuf<LOW_SPEED_REF) { DesiredSpeed=LOW_SPEED; } else { acbuf0=HIGH_SPEED-LOW_SPEED;//*(acbuf-LOW_SPEED_REF);)/(1023-LOW_SPEED_REF); acbuf0*=(acbuf-LOW_SPEED_REF); DesiredSpeed=(unsigned int)(acbuf0/(1023-LOW_SPEED_REF))+LOW_SPEED; } ADCON0bits.GO=1; } }
问题:用ICD2仿真时,把断点设置在ADCON0bits.GO=1;这里,发现始终不会停止,后经检查发现是因为DesiredSpeed这句进入之后就出不来了!点击程序暂停,发现程序复位了!!望各位老大给看看!!谢谢!!!芯片:PIC18F2431
|