Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] build error regarding simple uart code

Status
Not open for further replies.

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.

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;
}
 

The compiler is looking for a file names xc,h, and can't find it. Verify that that file is sitting in your include directory.
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top