SERIAL COMMUNICATION INTERFACE (SCI)
6 - 66
PORT C
MOTOROLA
MOVE
#B_SIZE,M0
;Load transmit buffer size
MOVE
#B_SIZE,M1
;Load transmit buffer size
MOVE
#B_SIZE,M2
;Load receive buffer size
MOVE
#B_SIZE,M3
;Load receive buffer size
MOVE
#>$1,N0
;Load receive address
MOVE
#>$1,N1
;Load first slave address
MOVE
#0,N2
;Load a constant (0) into N2
MOVEP
X:SRX,X:(R0)
;Clear receive register
;**************************************************
;
MAIN PROGRAM
*
;**************************************************
ANDI
#$FC,MR
;Re-enable interrupts
MOVE
(R1)+
;Temporarily increment the tail pointer
;Build a packet
LOOP
MOVE
R1,A
;Check to see if the TX buffer is full
MOVE
(R1)-
;(fix tail pointer now that we’ve used it)
MOVE
R0,B
;by comparing the head and tail pointers
CMP
A,B
;of the circular transmit buffer.
JEQ
SND_BUF
;if equal, transmit completed packet
MOVE
R5,X:(R1)+
;if not, put next character in
;transmit buffer and
MOVE
(R5)+
;increment the pointers.
MOVE
(R1)+
;Temporarily increment the tail
;pointer to test buffer again
JMP
LOOP
SND_BUF
JSR
WAKE_UP
;Wake up proper slave and send packet
SEND
JMP
SEND
;and allow interrupts to drain
;the transmit buffer.
Figure 6-34 Multidrop Transmit Receive Example (Sheet 3 of 4)
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
.
..