P.Copper
Member level 5
- Joined
- Mar 18, 2013
- Messages
- 82
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Activity points
- 1,807
Hi all
I've been trying to test my uart with this simple code below. my problem is that the compiler cant build the code it gives this error
"error: xc.h: No such file or directory".... I'm running the code with MPLAB IDE v8.70 c30 compiler.. and the chip is dspic30f4013. help woul surely be appreciated.
I've been trying to test my uart with this simple code below. my problem is that the compiler cant build the code it gives this error
"error: xc.h: No such file or directory".... I'm running the code with MPLAB IDE v8.70 c30 compiler.. and the chip is dspic30f4013. help woul surely be appreciated.
Code:
#include <stdio.h>#include <libpic30.h>
#include <p30f4013.h>
#include <uart.h>
#include <xc.h>
// Configuration settings
_FOSC(CSW_FSCM_OFF & FRC_PLL16); // Fosc=16x7.5MHz, Fcy=30MHz
_FWDT(WDT_OFF); // Watchdog timer off
_FBORPOR(MCLR_DIS); // Disable reset pin
int main()
{
TRISD = 0; // Set all port D pins as outputs
// Setup UART - most default options are fine
U1BRG = 48; // 38400 baud @ 30 MIPS
U1MODEbits.UARTEN = 1; // Enable UART
while(1)
{
printf("Hello\r\n"); // Send text via UART
_LATD0 = 1 - _LATD0; // Toggle LED on RD0
__delay32(30000000); // 1 second delay
}
return 0;
}