I have this code written by me when I tried to read text data it get stuck, I tried my best to solve this issues still I did not get any solution.
Now I am trying to add interrupt but I don't know how to add interrupt in this code. Although it is working well with single one bytes data.
The MCU I have pc18f67k40. The IDE I am using mikroC pro for pic.
I asked this question many times but mikroE guys did't try to solve this issue.
Code: Select all
void main(){
char uart_input[10], uart_output[10] = "0";
TRISC7_bit = 1; // RX1 as input
TRISC6_bit = 0; // TX1 as output
UART1_Init(9600);
Delay_ms(100);
RC1IE_bit = 1; // Enable UART receive interrupt
PEIE_bit = 1; // Enable peripheral interrupts
GIE_bit = 1; // Enable global interrupts
while(1){
if(UART1_Data_Ready() == 1){
UART1_Read_Text(uart_input, ";", 9);
UART1_Write_Text(uart_input);
strcpy(uart_output, uart_input);
}
else{
UART1_Write_Text(uart_output);
}
UART1_Write_Text("\r\n");
Delay_ms(1000);
}
}
Kumar