Specifications

Developer’s Serial Bootloader, Rev. 13
MCU slave software
Freescale Semiconductor46
;*******************************************************************************************
SCITX:
PSHH
PSHX
BCLR 7,TSC ; and clear TOF
LDHX ONEBIT
STHX TMOD
BSET 4,TSC ; clear timer
BCLR 5,TSC ; run timer
TXDCLR
MOV #9,BITS ; number of bits + 1
BRA SCITX1 ; jump to loop
SCITX2:
LSRA ; shift out lowest bit
BCC DATALOW
TXDSET
SKIP2 ; skip next two bytes
DATALOW:
TXDCLR
BCLR 7,TSC ; and clear TOF
SCITX1: BRCLR 7,TSC,SCITX1 ; wait for TOF
DBNZ BITS,SCITX2 ; and loop for next bit
SCISTOP:
TXDSET
BCLR 7,TSC ; and clear TOF
SCITX3: BRCLR 7,TSC,SCITX3 ; wait for TOF
EPILOG:
BSET 5,TSC ; stop timer
PULX
PULH
RTS
Figure 29. Software-SCI transmit char routine source code
8.2.2 Software-SCI receive char routine
The software-SCI receive char routine is similar to software-SCI transmit. When the 16-bit
output-compare event is polled, the value of the receive pin is scanned. No provisions are made for stop-bit
checking, framing check, noise detection, and others, mainly because of memory restrictions. The
following figure shows the software-SCI receive routine flowchart, and the source code is provided in
Figure 31.