I try to debug simple code
static void com_isr (void) interrupt 4 using 1 { unsigned char data c; /*- Received data interrupt. -*/ if (RI) { c = SBUF; RI = 0; ... ... } }
If you don't ever do anything with 'c' and since 'c' is defined as a local automatic, then the compiler correctly reads SBUF and discards the results. You should know this, this is how optimizing compilers work. You can either: 1) use the value in 'c' for something, like stuff it into an array, 2) declare it static (as you have), or 3) declare it volatile. What good is receiving a char if it will never be used? If you just want to discard Rx data then the statement:
SBUF;