#bit ninth_bit = RS232_ERRORS.7
#bit collision = RS232_ERRORS.6
#include <16F877.h>
#use delay(clock=4000000)
#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(collision)
{
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);
}