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);
}
Pwnie2012
  • 143
  • 1
  • 7

1 Answers1

0

try to include your library directly instead using plib.h

your chipkit uses PIC32MX320F128 microcontroller, so make sure you select it when you create a new mplab project and when you include the right header file.

One way to verify your workspace is to right click your code where you wrote RF0, go to "navigate" and then "go to declaration". If mplab opens the header file of your micro to show you the declaration of RF0 everything works fine.

If nothing happens, maybe you missed some step.

ciao!