Please have a look at the simple code below, please see if I am missing anything. I've try my chip on Hi Tech compiler and it works. Maybe I need to enable Global Interrupt and enable peripheral? However, if I am using UART2 then it works. A little confused, please help.
Code: Select all
void main() {
ANSELC = 0b00000000; // set all digital
TRISC = 0b10000001; //PORTc.B6 as output RX, B7 as input for Rx
UART1_Init(9600);
Delay_ms(100);
UART1_Write_Text("COM1 Ready...\n");
while(1) {
if(UART1_Data_Ready()) {
UART1_Write(UART1_Read());
}
}
}