打印
[PIC®/AVR®/dsPIC®产品]

关于使用官网源码编译器报错

[复制链接]
1301|4
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
本帖最后由 飞驰的蜗牛 于 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编译相同的代码


是正确的   求解为什么会出现这种原因    附 源代码    求指点

micro.png (13.96 KB )

mplab中编译错误

mplab中编译错误

KEIL.png (33.98 KB )

KEIL 中编译正确

KEIL 中编译正确

AN1078_dsPIC33FJ256MC710_MCLV.zip

926.63 KB

沙发
飞驰的蜗牛|  楼主 | 2015-7-13 16:27 | 只看该作者
难道是我使用和谐的C30造成的吗

使用特权

评论回复
板凳
yklstudent| | 2015-7-13 19:40 | 只看该作者
bit换成bits好了

使用特权

评论回复
地板
飞驰的蜗牛|  楼主 | 2015-7-14 08:16 | 只看该作者

谢谢指导  我知道原因了。 bit 是关键字 将在结构体成员bit改成bits 就好了

使用特权

评论回复
5
飞驰的蜗牛|  楼主 | 2015-7-14 08:51 | 只看该作者

再次请教一下  编译器接着编译 这次我换成xc16  
nbproject/Makefile-default.mk:78: recipe for target '.build-conf' failed  
出现这个错误  编译器跳转到错误位置式
${MAKE}  -f nbproject/Makefile-default.mk dist/${CND_CONF}/${IMAGE_TYPE}/PMSM.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}

这个错误是什么原因 请指教下  我从没遇到过

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

6

主题

22

帖子

0

粉丝