0

I received my chipKit Uno32 today and I wanted to program it with MPLab X. My code is fairly simple and just toggles a Pin (one with an LED...). When compiling, it gives me these errors though:

main.c: In function 'main':
main.c:9:5: error: '__PORTFbits_t' has no member named 'RF0'
main.c:13:13: warning: implicit declaration of function 'asm'
main.c:15:9: error: '__PORTFbits_t' has no member named 'RF0'
main.c:20:9: error: '__PORTFbits_t' has no member named 'RF0'
make[2]: *** [build/default/production/main.o] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 532ms)

plib.h is included and I enabled c99. When disabling c99, it compiles properly! Any ideas? I'd really like to use c99 since it features quite a ton of stuff I regularly use...

Code:

int main(int argc, char** argv) {

    mPORTFSetPinsDigitalOut(PORTFbits.RF0);

    while(1){
        for(int i = 0; i < 80000000; i++){
            asm("nop");
        }
        mPORTFSetBits(PORTFbits.RF0);

        for(int i = 0; i < 80000000; i++){
            asm("nop");
        }
        mPORTFClearBits(PORTFbits.RF0);
    }
    return (EXIT_SUCCESS);
}
4

1 回答 1

0

尝试直接包含您的库,而不是使用 plib.h

您的芯片套件使用 PIC32MX320F128 微控制器,因此请确保在创建新的 mplab 项目并包含正确的头文件时选择它。

验证您的工作区的一种方法是右键单击您编写 RF0 的代码,转到“导航”,然后“转到声明”。如果 mplab 打开您的 micro 的头文件以向您显示 RF0 的声明,一切正常。

如果什么都没发生,也许你错过了一些步骤。

再见!

于 2015-02-23T13:28:40.547 回答