I required the usage of serial port 1 on a Dallas 89C420. In order to use it i checked the example program Interrupt-Driven Serial I/O Support for printf filename "intsio.zip". The example was adapted to my needs but all initializations were maintained as well as the core of the interrupt function. The problem was that TI1 never went back to 0 and if i tried to force it outside the interrupt keil would crash (i use serial port 0 for the debugger). And if i did nothing the program just transmitted forever. I changed the program and started to transmit outside the interrupt with the following code:
int counter; for (counter=0;counter<msg_size;counter++) { TI1=0; SBUF1=msg[counter]; while (TI1==0) {} }
Hi, The idea behid received and tranmit using serial interrupt is 1. Receiving data sould be at the correct time other wise you will miss some data, So it should be activated when you received 1 byte or if you use FIFO the data should remove once it reach water mark of the FIFO 2. But transmit data is not like that, you can prepare the transmit buffer or fill your transmit fifo then you can call this function to transmit, what Keil is expalin is while you are filling the data into your transmit buffer you cannot enable tranmit interrupt.
The second think, Once you put some data into your tx buffer it will start to send, once it is sending you cannot put another data that is why the while loop is there, I beleived this will help you to understand