Datasheet
Synchronous Character Transmission using the SPI
M68HC12B Family Data Sheet, Rev. 9.1
Freescale Semiconductor 211
MOVB #$08,SC1CR2 ; Set for No Ints, and Transmitter enabled(SC1CR2)
LDAA SC1SR1 ; 1st step to clear TDRE flag: Read SC1SR1
STD SC1DRH ; 2nd step to clear TDRE flag: Write SC1DR register
LDX #DATA ; Use X as a pointer to DATA.
RTS ; Return from subroutine
; ----------------------------------------------------------------------
; TRANSMIT SUBROUTINE
; ----------------------------------------------------------------------
TRANS: BRCLR SC1SR1,#$80, TRANS ; Wait for TDRE flag
MOVB 1,X+,SC1DRL ; Transmit character, increment X pointer
CPX #EOT ; Detect if last character has been transmitted
BNE TRANS ; If last char. not equal to "eot", Branch to TRANS
RTS ; else Transmission complete, Return from Subroutine
; ----------------------------------------------------------------------
; TABLE : DATA TO BE TRANSMITTED
; ----------------------------------------------------------------------
DATA: DC.B 'Freescale HC12 Banner - June, 1999'
DC.B $0D,$0A ; Return (cr) ,Line Feed (LF)
DC.B 'Scottsdale, Arizona'
DC.B $0D,$0A ; Return (cr) ,Line Feed (LF)
EOT: DC.B $04 ; Byte used to test end of data = EOT
END ; End of program
14.6 Synchronous Character Transmission using the SPI
This program is intended to communicate with the HC11 on the UDLP1 board. It utilizes the SPI to
transmit synchronously characters in a string to be displayed on the LCD display. The program must
configure the SPI as a master, and non-interrupt driven. The slave peripheral is chip-selected with the SS
line at low voltage level. Between 8 bit transfers the SS
line is held high. Also the clock idles low and
takes data on the rising clock edges. The serial clock is set not to exceed 100 kHz baud rate.
14.6.1 Equipment
For this exercise, use the M68HC912B32EVB emulation board.
14.6.2 Code Listing
NOTE
A comment line is deliminted by a semi-colon. If there is no code before
comment, an “;” must be placed in the first column to avoid assembly
errors.
