本帖最后由 飞驰的蜗牛 于 2015-7-13 16:26 编辑
我使用的是C30编译器,打开在官网下载的AN1078的源代码 先定义
union {
struct
{
unsigned OpenLoop:1; // Indicates if motor is running in open or closed loop
unsigned RunMotor:1; // If motor is running, or stopped.
unsigned EnTorqueMod:1; // This bit enables Torque mode when running closed loop
unsigned EnVoltRipCo:1; // Bit that enables Voltage Ripple Compensation
unsigned Btn1Pressed:1; // Button 1 has been pressed.
unsigned Btn2Pressed:1; // Button 2 has been pressed.
unsigned ChangeMode:1; // This flag indicates that a transition from open to closed
// loop, or closed to open loop has happened. This
// causes DoControl subroutine to initialize some variables
// before executing open or closed loop for the first time
unsigned ChangeSpeed:1; // This flag indicates a step command in speed reference.
// This is mainly used to analyze step response
unsigned :8;
}bit;
WORD Word;
} uGF;
然后调用 uGF.bit.OpenLoop = 1; 在这个地方就出现错误
然后我使用KEIL MDK编译相同的代码
是正确的 求解为什么会出现这种原因 附 源代码 求指点
|