#include #include #include #include #include #pragma config LVP=OFF #pragma config WDT=OFF unsigned char r; int command; void main() { TRISB = 0; // check 65 and wait 10mS after opening the uart OpenUSART (USART_TX_INT_OFF & USART_RX_INT_OFF & USART_ASYNCH_MODE & USART_EIGHT_BIT & USART_CONT_RX & USART_BRGH_LOW, 65); Delay100TCYx(0x0f); RCONbits.IPEN = 1; IPR1bits.RCIP = 1; INTCONbits.GIEH = 1; OpenTimer2(TIMER_INT_OFF & T2_PS_1_16); PORTB=0; while(1) { while(BusyUSART()); while (!DataRdyUSART()); r = getcUSART(); PORTB=r; } }