a very, very odd thing.... #define BUFFER_SZ 64 unsigned char sBuf0tail; sBuf0tail = ((sBuf0tail + 1) % BUFFER_SZ); .. this increments a circular buffer index just fine. #define BUFFER_SZ 64 unsigned char sBuf0tail; sBuf0tail = ((sBuf0tail++) % BUFFER_SZ); .. this one never, ever increments. huh? is this some strange quirk of C I have never run into or is this a c51 compiler problem?
"Maybe sBuf0tail = ((++sBuf0tail) % BUFFER_SZ); will work. ++X is not the same as X++ in all cases." It's undefined behaviour either way.