
Secure Microcontroller User’s Guide
126 of 187
Table 14-C. Serial I/O Operating Modes
MODE SYNC/ASYNC BAUD CLOCK DATA BITS START/STOP
The serial port is controlled by the SCON register. Serial interrupts are also used, which are controlled by
IE and IP. The setup for each SFR is shown below. In addition, Mode 1 is associated with Timer 1, which
is controlled by TCON and TMOD.
Mode 1 is selected using the SCON register. The table from the SCON register shown below indicates
that Mode 1 is selected by choosing the value SM0 = 0 and SM1 = 1.
SM0 = 0 and SM1 = 1 corresponds to the value SCON.7 = 0 and SCON.6 = 1. In addition, since the
application must receive data, the serial receiver must be enabled. This is done by setting the REN bit at
SCON.4 to a logic 1. The remaining bits in SCON can be written to 0. Thus the value for SCON is 50h.
This application uses the serial interrupt, which serves two purposes. First, the software knows when a
byte has been sent, so it knows when another can be written. Second, after the 256 bytes have been
transmitted, the PC will respond. It is not known when this occurs, and the software may have other tasks
to attend. Therefore, the serial interrupt will inform the microcontroller when the confirmation code has
been received by the serial port. This example enables only the serial interrupt. It is set for high priority
since other interrupts might be enabled in a real system.
Komentáře k této Příručce