This is the Interrupt Service Routine (ISR) for the UART peripheral. Keep in mind that this is just a very high level routine for illustration purposes. Slide 10 showed the block diagram of the UART peripheral. An output of the module is the interrupt flag that is generated by the receive interrupt flag (RI0) or the transmit interrupt flag (TI0). In the ISR, it is necessary to check which condition caused the CPU to vector to the ISR and the example shown only executes the code based on which flag was set using the conditional statement. Each conditional statement tests the flag to see if it is set. If the condition is true, then the flag is cleared. The receive ISR pulls the data from the buffer so that it can be used by the application. The transmit side clears the flag. The application is generally responsible for placing the next byte to be transmitted into the transmit buffer (SBUF0).