Hardware Reference
In-Depth Information
Example 9.2
▼
Write an instruction sequence to configure the SCI0 to operate with the following
parameters:
•
9600 baud (E-clock is 24 MHz)
•
1 start bit, 8 data bits, and 1 stop bit format
•
No interrupt
•
Address mark wake-up
•
Disable wake-up initially
•
Long idle line mode
•
Enable receive and transmit
•
No loop back
•
Disable parity
•
SCI stops in
wait
mode
Solution:
The following instruction sequence will achieve the desired configuration:
movb
#$00,SCI0BDH
; set up baud rate to 9600
movb
#156,SCI0BDL
;
“
movb
#$4C,SCI0CR1
; select 8 data bits, address mark wake-up
movb
#$0C,SCI0CR2
; enable transmitter and receiver
The equivalent C statements are as follows:
SCI0BDH
5
0x00;
SCI0BDL
5
0x9C;
SCI0CR1
5
0x4C;
SCI0CR2
5
0x0C;
▲
Because the SCI circuit uses 0 and 5 V (or other lower voltages) to represent logic 0
and 1, respectively, it cannot be connected to the TIA-232 interface circuit directly.
A voltage translation circuit, called the
TIA-232 transceiver,
is needed to translate the
voltage levels of the SCI signals (RxD and TxD) to and from those of the corresponding
TIA-232 signals.
TIA-232 transceiver chips are available from many vendors. The LT1080/1081 from Linear
Technology, ST232 from ST Microelectronics, ICL232 from Intersil, MAX232 from MAXIM,
and DS14C232 from National Semiconductor are TIA-232 transceiver chips that can operate
with a single 5-V power supply and generate TIA-232 compatible outputs. These chips are also
pin compatible. In this section, we discuss the use of DS14C232 from National Semiconductor
to perform the voltage translation. The pin assignment and the use of each pin are shown in
Figure 9.17.
Search WWH ::
Custom Search