I've got a problem. I've posted it yesterday but it was probably lost in text.
static void Nastav_seriovy_kanal (void) { SCON = 0x50; TMOD = TMOD | 0x20; TH1 = 0xF4; TL1 = 0xF4; ES = 1; TR1 = 1; } static void Preruseni_seriovy_kanal (void) interrupt 4 { if (RI == 1) { RI = 0; if(SBUF == 'A') putchar('Q'); } if (TI == 1) TI = 0; }
It is a very bad idea to try to use these in an interrupt service routine! Well ... yeah. You can use them in an ISR, as long as you're aware that they are going to hog CPU cycles like crazy (they spinlock if the serial transmitter is busy) and that they're not reentrant. Also, I think there's some code putchar.c that could drop characters or enter an endless loop under certain rare circumstances. Something along the lines of
do { RI = 0; while(!RI); } while(SBUF != XON)