M68HC12A4EVB Freescale Semiconductor, M68HC12A4EVB Datasheet - Page 212

no-image

M68HC12A4EVB

Manufacturer Part Number
M68HC12A4EVB
Description
Manufacturer
Freescale Semiconductor
Datasheet

Specifications of M68HC12A4EVB

Lead Free Status / Rohs Status
Not Compliant
Serial Interface
INCLUDE 'EQUATES.ASM'
; User Variables
; Bit Equates
; ----------------------------------------------------------------------
;
; ----------------------------------------------------------------------
;
MAIN:
FINISH:
; ----------------------------------------------------------------------
;*
; ----------------------------------------------------------------------
INIT:
;
;
;
; ----------------------------------------------------------------------
;*
; ----------------------------------------------------------------------
TRANSMIT:
;
;
FLAG:
DONE:
; ----------------------------------------------------------------------
;
; ----------------------------------------------------------------------
DATA:
EOT:
212
TABLE OF DATA TO BE TRANSMITTED
ORG
BSR
BSR
BRA
BSET
MOVB
MOVB
MOVB
MOVB
LDX
LDAA
LDAA
BSET
RTS
LDAA
BEQ
BCLR
STAA
BRCLR
BSET
BRA
RTS
DC.B
DC.B
DC.B
END
TRANSMIT SUBROUTINE
SUBROUTINE INIT:
MAIN PROGRAM
$7000
INIT
TRANSMIT
FINIS
PORTS,#$80
#$E0,DDRS
#$07,SP0BR
#$12,SP0CR1
#$08,SP0CR2
#DATA
SP0SR
SP0DR
SP0CR1,#$40
1,X+
DONE
PORTS,#$80
SP0DR
SP0SR,#$80,FLAG
PORTS,#$80
TRANSMIT
'Freescale'
$0D,$0A
$00
;Equates for all registers
M68HC12B Family Data Sheet, Rev. 9.1
; 16K On-Board RAM, User code data area,
; start main program at $7000
; Subroutine to initialize SPI registers
; Subroutine to start transmission
; Finished transmitting all DATA
; SET SS Line High to prevent glitch
; Configure PORT S input/ouput levels
; MOSI, SCK, SS* = ouput, MISO=Input
; Select serial clock baud rate < 100 KHz
; Configure SPI(SP0CR1): No SPI interrupts,
; MSTR=1, CPOL=0, CPHA=0
; Config. PORTS output drivers to operate normally,
; and with active pull-up devices.
; Use X register as pointer to first character
; 1st step to clear SPIF Flag, Read SP0SR
; 2nd step to clear SPIF Flag, Access SP0DR
; Enable the SPI (SPE=1)
; Return from subroutine
; Load Acc. with "NEW" character to send, Inc X
; Detect if last character(0) has been transmitted
; If last char. branch to DONE, else
; Assert SS Line to start X-misssion.
; Load Data into Data Reg.,X-mit.
; it is also the 2nd step to clear SPIF flag.
;Wait for flag.
; Disassert SS Line.
; Continue sending characters, Branch to TRANSMIT.
; Return from subroutine
; Return (cr) ,Line Feed (LF)
; Byte used to test end of data = EOT
; End of program
Freescale Semiconductor