Task-Specific Program Code
C-20
Example C–13. Synchronous Serial Port Continuous Mode Transmission (ssp.asm)
* File:
ssp.asm
*
* Function:
Continuous transmit in CONTINUOUS mode
*
*
Internal shift clock and frame sync
*
*
Transmit FIFO level is set to 4
*
.title ”SSP Continuous mode”
; Title
.copy
”init.h”
; Variable and register declaration
.copy
”vector.h”
; Vector label declaration
.text
start:
clrc
cnf
; Map block B0 to data memory
ldp
#0h
; set DP=0
setc
INTM
; Disable all interrupts
splk
#0000h, 60h
; Set zero wait states
out
60h, wsgr
splk
#0cc0ch,60h
; reset the serial port by writing
out
60h, sspcr
; zeros at NOR/RES
splk
#0cc3ch,60h
; enable Sync port, 4 word fifo,
out
60h,sspcr
; internal clocks, Continuous mode
; Use sspcr= #0cc3eh for Burst mode
splk
#1717h,61h
; dummy data for tx
splk
#7171h,63h
splk
#0aa55h,64h
splk
#55aah,62h
; transmit 55aah on tx
splk
#10h,imr
; enable xinit interrupt
clrc
intm
; enable INTM
out
62h,sdtr
; Xmit once to start
out
61h,sdtr
; transmit interrupts
out
63h,sdtr
out
64h,sdtr
loop:
clrc
xf
; clear xf flag
idle
b
loop
codtx:
setc
xf
; set xf bit
out
62h,sdtr
; transmit 0x55aah again
out
61h,sdtr
; transmit 1717h
out
63h,sdtr
; transmit 7171h
out
64h,sdtr
; transmit aa55h
splk
#0010h, ifr
; clear ifr flag
clrc
intm
ret
codrx:
ret
inpt1:
ret
inpt23:
ret
timer:
ret
uart:
ret
.end
; Assembler module end directive
; –optional