English
Language : 

MC68HC16Z1CPV16 Datasheet, PDF (473/500 Pages) Freescale Semiconductor, Inc – Symbols and Operators, CPU16 Register Mnemonics
Freescale Semiconductor, Inc.
LDAA
ADDA
DAA
CMPA
BEQ
STD
JSR
RTI
SCCNT,Z
#$01
#$60
MINUTES
SCCNT,Z
DISPLAY
;increment # of seconds
;decimal adjust A
;compare # of seconds to 60
;if # of sec=60, then branch to minute routine
;if # of sec<60, store new # of sec
;send new time to dummy terminal for display
;return to main loop & wait for next interrupt
MINUTES:
CLR
LDAA
ADDA
DAA
CMPA
BEQ
STD
JSR
RTI
HOURS:
CLR
LDAA
ADDA
DAA
STD
CMPA
BNE
CLR
SCCNT,Z
MNCNT,Z
#$01
#$60
HOURS
MNCNT,Z
DISPLAY
MNCNT,Z
HRCNT,Z
#$01
HRCNT,Z
#$24
RETURN
HRCNT,Z
;advance counter for minutes
;set # of seconds to 0
;increment # of minutes
;decimal adjust A
;compare # of minutes to 60
;if # of min=60, then branch to hours routine
;if # of min<60, then store new # of min
;send new time to dummy terminal for display
;return to main loop & wait for next interrupt
;advance counter for hours
;set # of minutes to 0
;increment # of hours
;decimal adjust A
;store new # of hours
;compare # of hours to 24
;if # of hours < 24, then display new time
;if # of hours=24 then clear # of hours
RETURN: JSR
RTI
DISPLAY
;send new time to dummy terminal for display
;return to main loop & wait for next interrupt
***** Send Time to Dummy Terminal Routine *****
DISPLAY:
SEND_HR:
LDAB
JSR
HRCNT,Z
HEXTOASC
;this routine takes what is stored in sccnt,
;mncnt and hrcnt, converts them to ASCII
;characters, and then sends them to a dummy
;terminal.
;output the hours
;convert hex number into ASCII and print
SEND_COL:
LDAB
JSR
#$3A
SEND_CH
;output a colon
;ASCII number for a colon
;send character to terminal
SEND_MIN:
LDAB
JSR
MNCNT,Z
HEXTOASC
;output the minutes
;convert hex number to ASCII and print
SN_COLON:
LDAB
JSR
#$3A
SEND_CH
;output another colon
;ASCII number for a colon
;send character to terminal
SEND_SEC:
;output the seconds
M68HC16 Z SERIES
USER’S MANUAL
INITIALIZATION AND PROGRAMMING EXAMPLES
For More Information On This Product,
Go to: www.freescale.com
E-21