SERIAL COMMUNICATION INTERFACE (SCI)
MOTOROLA
PORT C
6 - 45
bus has an additional data type bit. The SCI can operate in full-duplex or half-duplex
modes since the transmitter and receiver are independent. The SCI transmitter and re-
ceiver can use either the internal clock (TCM=0 and/or RCM=0) or an external clock
(TCM=1 and/or RCM=1) or a combination. If a combination is used, the transmitter and
receiver can run at different data rates.
6.3.7.1
Asynchronous Data Reception
Figure 6-22 illustrates initializing the SCI data receiver for asynchronous data. The first
step (1) resets the SCI to prevent the SCI from transmitting or receiving data. Step two (2)
selects the desired operation by programming the SCR. As a minimum, the word format
(WDS2, WDS1, and WDS0) must be selected, and (3) the receiver must be enabled
(RE=1). If (4) interrupts are to be used, set RIE equals one. Use Table 6-3 (a) through
Table 6-4 (b) to set (5) the baud rate (SCP and CD0–CD11 in the SCCR). Once the SCI
is completely configured, it is enabled by (6) setting the RXD bit in the PCC.
The receiver is continually sampling RDX at the 16
×
clock rate to find the idle-start-bit
transition edge. When that edge is detected (1) the following eight or nine bits, depending
on the mode, are clocked into the receive shift register (see Figure 6-23). Once a com-
plete byte is received, (2) the character is latched into the SRX, and RDRF is set as well
ORG
P:0
;Reset vector
JMP
$40
;
ORG
P:$14
;SCI receive data vector
MOVEP
X:$FFF4,Y:(R0)+ ;Receive low byte of data
NOP
;Fast interrupt response
MOVEP
X:$FFF1,X0
;Receive with exception. Read status register
MOVEP
X:$FFF4,Y:(R0)+
;Receive low byte of data
ORG
P:$40
MOVEP
#0,X:$FFFE
;Clear BCR
MOVE
#$100,R0
;Data ROM start address
MOVE
#$FF,M0
; Size of data ROM – wraps around at $200
MOVEP
#$C000,X:$FFFF ;Interrupt priority register
MOVEP
#$900,X:$FFF0
; 8-bit synchronous mode receive only
MOVEP
#$C000,X:$FFF2 ;Clock control register external clock
MOVEP
#7,X:$FFE1
;Port C control register – enable SCI
MOVEC
#0,SR
;Unmask interrupts
LAB0 JMP
LAB0
;Wait in loop for interrupts
Figure 6-21 SCI Synchronous Receive
F
re
e
sc
a
le
S
e
m
ic
o
n
d
u
c
to
r,
I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
c
.
..