//
// UART Echo Example
// By PEK '2004
//
// MCU: 16F877
// Clock: 10 MHz
//
// To be used with the CCS compiler
//

#include <16F877.h>
#use delay(clock=10000000)
#fuses HS,NOWDT,NOPROTECT,NOLVP

#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,errors)


#int_RDA
void RDA_isr()
{
   // Check for errors
   if(RS232_ERRORS & 0x06)
   {
      output_high(PIN_B0); // Tells the user about the error
   }
   else
   {
      putc(getc() + 1);
   }
}


void main()
{
   output_low(PIN_B0);  // No errors from the beginning

   enable_interrupts(INT_RDA);   // Enable Rx interrupt
   enable_interrupts(GLOBAL);    // Enable Global interrupts

   while(1);
}
