English
Language : 

MC68HC16Z1CPV16 Datasheet, PDF (472/500 Pages) Freescale Semiconductor, Inc – Symbols and Operators, CPU16 Register Mnemonics
Freescale Semiconductor, Inc.
CMPB
BNE
LDX
BRA
NO_DOG: LDX
PRINT: JSR
ANDP
#$20
NO_DOG
#DOG_STRING
PRINT
#NO_DOG_STR
SEND_STRING
#$FF1F
;choose which string start address to load
;COP caused the reset
;COP did not cause the reset
;print the string to the screen
;set interrupt priority mask level to 0
***** The Main Program *****
MAIN: NOP
BRA
MAIN
***** Subroutines *****
;keep on looping until watchdog causes a reset
;or we get some other interrupt
SEND_STRING:
string
LDAB
BEQ
JSR
AIX
BRA
STRING_DONE:
RTS
0,X
STRING_DONE
SEND_CH
#$01
SEND_STRING
;subroutine to send out the entire ASCII
;get next byte in string as pointed to by IX
;if B=00, then we're done
;go send out the byte
;increment IX to point to the next byte
;loop back and do next byte in string
;go back to whence we came
SEND_CH:
LDAA
ANDA
BEQ
again
LDAA
STD
TC_LOOP:
LDAB
ANDB
BEQ
RTS
SCSR
#$01
SEND_CH
#$00
SCDR
SCSR+1
#$80
TC_LOOP
;subroutine to send out one byte to SCI
;read SCI status reg to check/clear TDRE bit
;check only the TDRE flag bit
;if TDR is not empty, go back to check it
;clear A to send a full word to SCDR ($FFC0E)
;transmit one ASCII character to the screen
;test the TC bit (transfer complete)
;continue to wait until TC is set
;finish sending out byte
***** The STRINGs *****
DOG_STRING DC 'The Software Watchdog just caused a reset!',0a,0d,00
NO_DOG_STR DC 'The last reset was not caused by the COP.',0a,0d,00
AUTOV_STRING DC 'Feeding the dog...',0a,0d,00
***** Periodic Interrupt Vector Routine *****
VECRT:
SECONDS:
;When the processor is interrupted by the
;periodic timer, it will run this routine.
;This routine simply increments a clock
;every time it is interrupted, and prints
;the clock out on the dummy terminal.
;advance the counter for seconds
E-20
INITIALIZATION AND PROGRAMMING EXAMPLES
For More Information On This Product,
Go to: www.freescale.com
M68HC16 Z SERIES
USER’S MANUAL