菜鸟在程序中定义了这样一个结构<br />typedef struct <br />{<br /> INT8U MotorDirection; <br /> INT8U PulseDirection; <br /> INT16U StepsCounter; <br /> INT16U MotorStepsSum; <br /> INT16U MotorStepsOld; <br /> <br /> INT16U Timer2Flagint; <br /> <br /> INT8U MotorStatus; <br /> INT16U Counter; <br /> INT16U Sum; <br /> INT16U TimerPulseCounter; <br /> INT16U TimeIntcount; <br /> INT32U CounterTime; <br /> INT16U MaxFrequent; <br /> INT16U MinFrequent; <br /> INT16U IntervalFrequent; <br />} MOTOR_INFO;<br /><br /> extern MOTOR_INFO MotorInfo[SUMMOTOR];<br />在定时中断函数中使用 <br />void Timer2Handler (void) __irq <br />{ <br /> static INT32U timer2_counter=0;<br /> INT8U i;<br /> T2IR = 1; /* clear interrupt flag */<br /> timer2_counter++;<br /> for(i=0;i<SUMMOTOR;i++)<br /> {<br /> MotorInfo.Timer2Flagint++;<br /> }<br /> i=0;<br /> MoveStepMotor( ); <br /> if(timer2_counter>=10000000) <br /> timer2_counter=0;<br /> VICVectAddr = 0; /* Acknowledge Interrupt */<br />}<br />可是出现这样的错误<br />Error : C2456E: undeclared name, inventing 'extern int MotorInfo'<br />timer.c line 145 <br />Project: UNIVERSAL.mcp, Target: RunInFlash, Source File: timer.c<br /><br />Error : (Serious) C2947E: Illegal types for operands: <subscript><br />timer.c line 145 <br />Project: UNIVERSAL.mcp, Target: RunInFlash, Source File: timer.c<br /><br />Error : C2456E: undeclared name, inventing 'extern int Motornum'<br />StepMotor.c line 266 <br />Project: UNIVERSAL.mcp, Target: RunInFlash, Source File: StepMotor.c<br /><br />怎么回事啊 大侠救命啊<br /> |
|