Mitsubishi DS907x SIP Serial I/O Function Description, Serial Port Operating Modes ±1, Start/Stop

Models: DS5000TK DS907x SIP

1 174
Download 174 pages 46.43 Kb
Page 110
Image 110

USER'S GUIDE

SECTION 14: SERIAL I/O

FUNCTION DESCRIPTION

The Secure Microcontroller, like the 8051, includes a powerful Serial I/O (UART) port capable of both syn- chronous 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±du- plex 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. Once a word is received, the software should read the receive buffer before another word is completely received. The serial port will automatically transfer the new word into the receive buffer regardless of whether software has read the old value. This destroys the data that had been present from the previous word. At 9600

baud, receiving an asynchronous word takes 1.04 ms. Thus software must read a received word within 1.04 ms 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 automati- cally 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 capa- ble 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 men- tioned above.

SERIAL PORT OPERATING MODES Table 14±1

MODE

SYNC/ASYNC

BAUD CLOCK

DATA BITS

START/STOP

9TH DATA BIT

FUNCTION

 

 

 

 

 

MODE 0

SYNC

12 tCLK

8

None

None

MODE 1

ASYNC

Timer 1

8

1 Start

None

 

 

Overflow

 

1 Stop

 

 

 

 

 

 

MODE 2

ASYNC

32 tCLK or

9

1 Start

0, 1, or parity

 

 

64 tCLK

 

1 Stop

 

MODE 3

ASYNC

Timer 1

9

1 Start

0, 1, or parity

 

 

Overflow

 

1 Stop

 

 

 

 

 

 

The serial port has four modes (Mode 0±3) of operation as shown in Table 14±1. 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.

Mode 1 is a 10±bit asynchronous mode using 8±bit words, one start bit, and one stop bit. The time base is generated from the Timer 1 overflow and is therefore fully programmable. A user simply loads the timer with a

050396 109/173

110

Page 110
Image 110
Mitsubishi DS907x SIP manual Serial I/O Function Description, Serial Port Operating Modes ±1, Mode SYNC/ASYNC Baud Clock