beautypg.com

Serial interface 0 and 1, Serial interface 0 modes – Maxim Integrated 71M6513H Power Meter IC Family Software User Manual

Page 119

background image

71M651x Software User’s Guide

6.3.3. Serial Interface 0 and 1

The serial buffer consists of two separate registers, a transmit buffer and a receive buffer.

Writing data to the Special Function Register S0BUF or S1BUF sets this data in the serial output buffer and starts
transmission. Reading from the S0BUF or S1BUF reads data from the serial receive buffer. The serial port can
simultaneously transmit and receive data. It can also buffer 1 byte at receive, preventing the receive data from being
lost if the MPU reads the first byte before transmission of the second byte is completed.

Serial Interface 0 Modes

The Serial Interface 0 can operate in 4 modes:

Mode 0

Pin rxd0 serves as an input and an output. Txd0 outputs the shift clock. 8 bits are transmitted starting with the LSB.
The baud rate is fixed at 1/12 of the MPU frequency. Reception is initialized in Mode 0 by setting the flags in S0CON
as follows: RI0=0 and REN0=1. In other modes, when REN0 = 1, a start bit initiates receiving serial data.

Mode 1

Pin rxd0 serves as an input, and txd0 serves as a serial output. No external shift clock is used. 10 bits are transmitted:
a start bit (always 0), 8 data bits (LSB first), and a stop bit (always 1). On receive, a start bit synchronizes the
transmission. 8 data bits are available by reading S0BUF, and the stop bit sets the flag RB80 in the Special Function
Register S0CON. In mode 1 either the internal baud rate generator or timer 1 can be use to specify the baud rate.

Mode 2

This mode is similar to Mode 1, with two differences. The baud rate is fixed at 1/32 or 1/64 of the oscillator frequency
and 11 bits are transmitted or received: a start bit (0), 8 data bits (LSB first), a programmable 9

th

bit, and a stop bit (1).

The 9

th

bit can be used to control the parity of the serial interface: at transmission, bit TB80 in S0CON is output as the

9

th

bit, and at receive, the 9

th

bit affects RB80 in the Special Function Register S0CON.

Mode 3

The only difference between Mode 2 and Mode 3 is that in Mode 3, either the internal baud rate generator or timer 1
can be use to specify the baud rate.

The common FLAG protocol requires the data format to be 7E1. This can be implemented using one of the
8-bit modes, where the MSB (bit 0) is the parity bit. In this mode, the MPU calculates parity.

Serial Interface 0 Control Register (S0CON).

The function of the serial port 0 depends on the setting of the Serial Port Control Register S0CON.

MSB

LSB

SM0

SM1

SM20

REN0

TB80

RB80

TI0

RI0

Table 6-27: The S0CON Register

Revision 2.4

TERIDIAN Proprietary

119 of 137

© Copyright 2005-2006 TERIDIAN Semiconductor Corporation