We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi Community, i have a big problem. I want to write something like a ECHO - Funktion. That means i recive a char an send it back like in this source ...
void serial_int (void) interrupt 4 using 3 { static char chr = '\0'; if (RI == 1) { chr = SBUF; RI = 0; TI = 1; TL0 = 0xFF; } else if (TI == 1) { TI = 0; if (chr != '\0') { if (chr == '\r') chr = '\n'; SBUF = chr; while(TI == 0); TL0 = 0xFF; chr = '\0'; } } }
Yes , i have looked at this example. But it's to slow too. Isn't there any way to do this faster. I thing its the time i am waiting for the TI.
"I thing its the time i am waiting for the TI" You aren't waiting for TI. When TI goes true the ISR is called. Are you just trying to echo characters back out of the UART?
static void com_isr (void) interrupt 4 using 1 { .... putbuf(c); .... } void putbuf (char c) using 0 { The default "using 0" added to show the problem. Erik
static void com_isr (void) interrupt 4 using 1 { .... putbuf(c); .... } void putbuf (char c) using 0 {
"But it's to (sic) slow too." What precisely do you mean by "too slow?" How long does it take? How long do you want it to take? What processor are you using, and how fast are you clocking it?
I have a device with four 7-seg. digits, i am multiplexing them by using the Timer0. My PS bit is set. It must be set using a baudrate 19200. So when i recive a byte i send it back. An the program jumb into the ISR again. And now the digits starts to flash because they were not multiplexed.