Please help me to find the problem: In my program, I use UART to receive data by UART interrupt, please see following. #define uchar unsigned char #define DATALTH 255 volatile uchar SerBuffer; volatile uchar I_ptr; void isr_UART(void) interrupt SIO_VECTOR using 0 { uchar c; if(RI) { c = SBUF; RI = FALSE; SerBuffer[I_ptr & (DATALTH -1)] = c; } } But when I use memset(SerBuffer,0x00,DATALTH); or Addr = strchr(SerBuffer,0x22); to clear "SerBuffer" or search 0x22 from "SerBuffer" and during the progress there are data received by UART, then there will be serious error. Please tell me the reason. thank you.
I'm sorry for mis-type. In fact, I define "SerBuffer" with volatile uchar SerBuffer[DATALTH]; Thanks.