English
Language : 

MC68HC16Z1CAG16 Datasheet, PDF (474/500 Pages) Freescale Semiconductor, Inc – M68HC16Z Series users manual
Freescale Semiconductor, Inc.
LDAB
JSR
SCCNT,Z
HEXTOASC
;convert hex number to ASCII and print
LINE_FD:
LDAB
JSR
#$0A
SEND_CH
;output a linefeed
;load ASCII number for line feed
;send character to terminal
CARRIAGE:
LDAB
JSR
#$0D
SEND_CH
;output a carriage return
;ASCII number for carriage return
;send character to terminal
RTS
;done with display routine
***** Hexadecimal to ASCII conversion *****
HEXTOASC:
STD
JSR
LDD
ANDB
BRA
PRTMSB: LSRB
LSRB
LSRB
LSRB
PRTLSB:
ADDB
CMPB
BLS
ADDB
NOTAF: JSR
RTS
TEMP,Z
PRTMSB
TEMP,Z
#$0F
PRTLSB
#$30
#$39
NOTAF
#$07
SEND_CH
;the following code takes a number or
;character stored in register D, assumes
;it's in its hexadecimal form and converts
;it to an ASCII equivalent. It also sends
;that character to the screen.
;store the hex number temporarily into “TEMP”
;reload value of hex number into D register
;get rid of upper 4 bits in hex number
;shift high 4 bits down to low 4 bits position
;the actual conversion process:
;add $30 to the hex number
;check for digithood
;go print now if it's a digit 0-9
;it's a letter A-F, so add $07 before printing
;send the character to the SCI
;done with hex to ascii conversion
***** Autovector Routine *****
AUTOV:
reset.
LDAB #$55
STAB SWSR
LDAB #$AA
STAB SWSR
;when IRQ6 is low, this autovector routine starts
;These four lines reset the watchdog and keep it
;from causing a system reset by writing to the SWSR
;By writing a #$55 and a #$AA to the SWSR before
;the end
;of every time-out period, the watchdog will be
LDX #AUTOV_STRING
JSR SEND_STRING
RTI
;return to the main loop
***** Other exception/interrupts *****
BDM: BGND
;all other exception vectors point here
;and put the user into background mode
E-22
INITIALIZATION AND PROGRAMMING EXAMPLES
For More Information On This Product,
Go to: www.freescale.com
M68HC16 Z SERIES
USER’S MANUAL