/* Serial Communication Transmit Example */
/* Using Port C as a USART Port */
#pragma config OSC = HS /*set osc mode to HS */
#pragma config WDT = OFF /* set watchdog timer off */
#pragma config LVP = OFF /* Low Voltage Programming Off */
#pragma config DEBUG = OFF /* Compile without extra Debug compile Code */
#include <p18f4520.h>
#include <delays.h>
#include <usart.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void main ()
{
char ch;
FILE *fp;
/* Make Port C O/P */
TRISC = 0x00;
/* Set USART Parameters Baud rate 19.200 */
OpenUSART(USART_TX_INT_OFF & USART_RX_INT_OFF & USART_ASYNCH_MODE & USART_EIGHT_BIT & USART_CONT_RX & USART_BRGH_LOW, 15);
fp = fopen("test.txt","r");// read mode
while( ( ch = fgetc(fp) ) != EOF )
putrsUSART("%c",ch);
fclose(fp);
}