thannara123
Advanced Member level 5
UART data (in interrupt) reception not receive data ,after coming in the endless while(1); loop even interrupt occur.
I am using Pic16f877a code work well without the while loop which is comment offed
what is the reason why dont go the code to ISR_UART after went into the while loop
I am using Pic16f877a code work well without the while loop which is comment offed
what is the reason why dont go the code to ISR_UART after went into the while loop
C:
char Uart_RC_Data ;
void interrupt UART_Interrupt()
{
if(RCIF ) // if interrupt occurred RCIF will be one
{
while(OERR) // if there is error
{
// __delay_us(100);
CREN=0; // restart UART
OERR=0;
}
CREN=1;
Uart_RC_Data = RCREG; // global variables to read received data
}
}
void main(void)
{
//OPTION_REG &= 0x7F;
TRISB =0x00;
TRISD = 0x00;
LCD_init();
TRISC6=0; //Output (TX)
TRISC7=1; //Input (RX)
ser_int();
while(1)
{
LINE1;
string(" Uart Data Rcved");
LINE2;
LCD_data(Uart_RC_Data);
__delay_ms(100);
while(1); // whenever use this loop its not working
}
}
Last edited: