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