I am testing simple 8051 program that polls for a character from serial port and output it out to the serial port again. In the main function, I do the following continously
u8_t xdata c; while(slipdev_char_poll(&c)) { slipdev_char_put(c); break; }
void slipdev_char_put(u8_t chr){ int delaycount; putchar(chr); for (delaycount=0;delaycount<1000;delaycount++){} return; } u8_t slipdev_char_poll(u8_t xdata *chr){ if (RI==1){ //Character is available *chr = SBUF; RI = 0; return 1; }else{ //Character not available return 0; } }
u8_t xdata c; while(slipdev_char_poll(&c)) { putchar(c); break; }
View all questions in Keil forum