Serial i/o, 1 function description, Unction – Maxim Integrated Secure Microcontroller User Manual
Page 115: Escription

Secure Microcontroller User’s Guide
115 of 187
14. SERIAL I/O
14.1 Function Description
The secure microcontroller, like the 8051, includes a powerful serial I/O (UART) port capable of both
synchronous and asynchronous communication. The baud rate and time-base source is fully
programmable. The serial port uses P3.0 as receive data (RXD) and P3.1 transmit data (TXD). Note that
no special action other than enabling the function (i.e., writing a logic 1 to the corresponding port pins) is
required to make these pins become the serial port. The serial port is capable of full duplex operation in
asynchronous mode and half-duplex operation in synchronous mode.
The serial port consists of a receive shift register, receive buffer, transmit shift register and control logic.
An incoming serial word from an external source is shifted into the receive shift register one bit at a time.
Bits are shifted at the baud rate, which is programmable. The baud rate must be programmed by user’s
software to match the incoming frequency or the serial data will be unintelligible. Once the word is
received, the serial port transfers it into the receive buffer. At this time, the serial port can receive another
byte into its shift register. At 9600 baud, receiving an asynchronous word takes 1.04ms. Thus software
must read a received word within 1.04ms or it may be overwritten by another incoming word.
The transmit shift register has no buffer. Software writes into the shift register and the word is
immediately shifted out. Thus software must wait until the serial word is shifted out before writing
another to transmit. Both the receive buffer and the transmit shift register are located in the SFR map.
Furthermore, they reside at the same address called SBUF (99h). Reading SBUF automatically transfers
the word out of the serial receive buffer. Writing to SBUF automatically transfers a byte into the transmit
shift register. Serial Port operation is controlled via the SCON (98h) register.
Each serial port function (receive and transmit) is capable of generating an interrupt. If enabled, the
receive function interrupts the CPU when a word has been shifted in. This indicates that software should
read the receive buffer. The serial port will set the RI flag bit in the SCON.0 location to indicate the
source of the interrupt. The serial port will also generate an interrupt when it has completely shifted out a
word. This indicates that another word can be transmitted. The serial port will set the TI flag bit at
SCON.1 to indicate the source of the interrupt. Remember that the Serial Interrupt vectors to location 23h
regardless of the source. The ISR must determine the cause of the interrupt from the flags mentioned
above.
The serial port has four modes (Mode 0-3) of operation as shown in
. Mode 0, is a
synchronous mode. This means that the microcontroller serial port will supply a clock to synchronize the
data I/O shifting. One clock pulse is generated per bit. The external device that is communicating with the
micro must also use this clock. This mode is typically used with serial peripherals. Synchronous mode is
generally capable of a higher speed communication speeds than the asynchronous modes. It generates its
speed as a fixed function of 12 microcontroller oscillator clocks per bit.