English
Language : 

MC68HC812A4 Datasheet, PDF (261/342 Pages) Motorola, Inc – 16-bit device composed of standard on-chip peripheral modules connected by an intermodule bus. Modules include
Serial Communications Interface Module (SCI)
Serial Character Transmission using the SCI
14.13.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.
INCLUDE 'EQUATES.ASM'
; Equates for registers
; User Variables
; Bit Equates
; ----------------------------------------------------------------------
;
MAIN PROGRAM
; ----------------------------------------------------------------------
ORG $7000
; 16K On-Board RAM, User code data area,
;
; start main program at $4000
MAIN:
BSR INIT
; Subroutine to Initialize SCI0 registers
BSR TRANS
; Subroutine to start transmission
DONE: BRA DONE
; Always branch to DONE, convenient for breakpoint
; ----------------------------------------------------------------------
;
SUBROUTINE INIT:
; ----------------------------------------------------------------------
INIT: TPA
; Transfer CCR to A accumulator
ORAA #$10
; ORed A with #$10 to Set I bit
TAP
; Transfer A to CCR
MOVB #$34,SC1BDL
; Set BAUD =9600, in SCI1 Baud Rate Reg.
MOVB #$00,SC1CR1
; Initialize for 8-bit Data format,
;
; Loop Mode and parity disabled,(SC1CR1)
MOVB #$08,SC1CR2
; Set for No Ints, and Transmitter enabled(SC1CR2)
LDAA SC1SR1
STD SC1DRH
; 1st step to clear TDRE flag: Read SC1SR1
; 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 'Motorola 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
Advance Information
MOTOROLA
Serial Communications Interface Module (SCI)
MC68HC812A4 — Rev. 3.0
261