SYNCHRONOUS SERIAL INTERFACE (SSI)
MOTOROLA
PORT C
6 - 151
MOVEP #$08,X:PCDDR
;SC0 (PC3) as general purpose output.
MOVEP #$001F,X:CRA
;Set Word Length=8, CLK=5.12/32 MHz.
MOVEP #$1E30,X:CRB
;Enable transmitter, Mode=On- Demand,
;Gated clock on, synchronous mode,
;Word frame sync selected, frame
;sync and clock are internal and
;output to port pins.
MOVEP #$1F0,X:PCC
;Set PCC for SSI and
LOOP0
BSET
#3,X:PCD
;Set PC3 high (this is example enable
;or strobe for an external device
:such as an ADC).
MOVEP X:(R0);pl,X:TX
;Move data to TX register
TDE1
JCLR
#6,X:SSISR,TDE1 ;Wait for TDE (transmit data register
;empty) to go high.
MOVEP X:(R0);pl,X:TX
;Move next data to TX.
TDE2
JCLR
#6,X:SSISR,TDE2 ;Wait for TDE to go high.
MOVEP X:(R0);pl,X:TX
;Move data to TX.
TDE3
JCLR
#6,X:SSISR,TDE3 ;Wait for TDE=1.
FSC
JSET
#5,X:PCD,FSC
;Wait for frame sync to go low. NOTE:
;State of frame sync is directly
;determined by reading PC5.
BCLR
#3,X:PCD
;Set PC3 lo (example external enable).
;anything goes here (i.e., any processing)
REP
#100
NOP
JMP
LOOP0
;Continue sequence forever.
END
Figure 6-85 On-Demand Mode Transmit Example Program (Sheet 2 of 2)
Figure 6-86 is the receive program for the scoping loop program presented in Figure 6-85.
The receive program also uses the on-demand, gated, synchronous mode with no inter-
rupts (polling). Initialization for the receiver is slightly different than for the transmitter. In
CRB, RE is set rather than TE, and SCKD and SCD2 are inputs rather than outputs. After
initialization, a JCLR instruction is used to wait for a data word to be received (RDF=1).
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
.
..
Содержание DSP56002
Страница 380: ......
Страница 382: ......
Страница 390: ...Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc...