Asynchronous / synchronous serial interface UM0404
248/564 DocID13284 Rev 2
A transmission is started by writing to the Transmit Buffer register S0TBUF (via an
instruction or a PEC data transfer).
Only the number of data bits which is determined by the selected operating mode will
actually be transmitted. Bits written to positions 9 through 15 of register S0TBUF are always
insignificant. After a transmission has been completed, the transmit buffer register is cleared
to 0000h.
Data transmission is double-buffered, so a new character may be written to the transmit
buffer register, before the transmission of the previous character is complete. This allows
the transmission of characters back-to-back without gaps.
Data reception is enabled by the Receiver Enable bit S0REN. After reception of a character
has been completed, the received data and, if provided by the selected operating mode, the
received parity bit can be read from the (read-only) Receive Buffer register S0RBUF.
Bits in the upper half of S0RBUF which are not valid in the selected operating mode will be
read as zeros.
Data reception is double-buffered, so that reception of a second character may already
begin before the previously received character has been read out of the receive buffer
register.
In all modes, receive buffer overrun error detection can be selected through bit S0OEN.
When enabled, the overrun error status flag S0OE and the error interrupt request flag
S0EIR will be set when the receive buffer register has not been read by the time reception of
a second character is complete. The previously received character in the receive buffer is
overwritten.
The Loop-Back option (selected by bit S0LB) allows the data currently being transmitted to
be received simultaneously in the receive buffer.
This may be used to test serial communication routines at an early stage without having to
provide an external network. In loop-back mode the alternate input/output functions of the
Port3 pins are not necessary.
Note: Serial data transmission or reception is only possible when the Baud rate Generator Run bit
S0R is set to ‘1’. Otherwise the serial interface is idle.
Do not program the mode control field S0M in register S0CON to one of the reserved
combinations to avoid unpredictable behavior of the serial interface.
S0TBUF (FEB0h / 58h) SFR Reset Value: 0000h
S0LB
Loopback Mode Enable bit
0: Standard transmit/receive mode
1: Loopback mode enabled
S0R
Baud rate Generator Run bit
0: Baud rate generator disabled (ASC0 inactive)
1: Baud rate generator enabled
Bit Function
1514131211109876543210
------- Transmit Data Buffer
RW