I have a verry simple programm that is trying to write some data into UART 3 :
- Code: Select all
/********************************
Dependencies: xc.h, stdio.h
Processor: PIC32MX795F512L
Complier: XC32 v1.32
Debugger: Simulator
********************************/
#include <xc.h>
#include <stdio.h>
void _mon_putc (char c)
{
while (U3STAbits.UTXBF); //Wait till transmission is complete
U3TXREG = c;
}
int main (void)
{
U3MODEbits.UARTEN = 0x01; //Enable UART module
U3STAbits.UTXEN = 0x01;// Enable UART transmission
printf("Hello World");
while(1);
return 0;
}
I took it from the wiki, it is verry simple and builds fine on MPLAB X, but I can't find a way to build this from the terminal...
I simply type
and get folowing error :xc32-gcc main.c
main.c: In function '_mon_putc':
main.c:13:12: error: 'U3STAbits' undeclared (first use in this function)
while (U3STAbits.UTXBF); //Wait till transmission is complete
^
main.c:13:12: note: each undeclared identifier is reported only once for each function it appears in
main.c:14:8: error: 'U3TXREG' undeclared (first use in this function)
U3TXREG = c;
^
main.c: In function 'main':
main.c:21:4: error: 'U3MODEbits' undeclared (first use in this function)
U3MODEbits.UARTEN = 0x01; //Enable UART module
^
main.c:22:4: error: 'U3STAbits' undeclared (first use in this function)
U3STAbits.UTXEN = 0x01;// Enable UART transmission
Can anyone tell me a bit more about the buildsystem of MPLAB X? If you have a tip or a workaround it would be helpfull !