3.c.03. Command 220: Send UART Byte

Effect: This command sends a byte to the mega168 so it can be transmitted by the mega168 over the UART. The mega168 puts the received byte into a 32-byte circular UART send buffer. It then transmits the bytes in the send buffer in the order they were received over the UART (and removes them from the buffer) as the mega168 executes the UART-handling portion of its main loop. When the send buffer is full, the mega168’s status byte has its STATUS_UART_SEND_FULL bit set and the attention line is set to indicate that the mega644 should not transmit any more UART bytes until there is more room in the send buffer. The amount of free space in the send buffer can be obtained at any time by sending the Get Send Free Space in Send Buffer command (222—Section 3.c.04).

If you attempt to send a byte while the send buffer is full, you will cause a send buffer overrun error, which will be reflected in the UART error byte. The UART error byte can be read by sending the Get UART Error command (252—Section 3.c.07). The mega168’s status byte will have its STATUS_UART_ERROR bit set and the attention line is set to reflect the presence of this UART error.