English
Language : 

MC68HC16Z1CPV16 Datasheet, PDF (479/500 Pages) Freescale Semiconductor, Inc – Symbols and Operators, CPU16 Register Mnemonics
Freescale Semiconductor, Inc.
STAB TMSK2
;& set the TCNT's prescale to sysclock/128
*
Set up Input Capture and Output Compare
LDAB
STAB
LDAB
STAB
LDD
STD
#$27
TCTL2
#$01
TCTL1
#$1000
TOC2
;Input Captures
;TIC1=either, TIC2=rise, TIC3=fall, TIC4=off
;Output Compares
;TOC2=toggle, TOC3=off, TOC4=off, TOC5=off
;set OC2 to toggle every time that
;TCNT is #$1000
*
Set up the Pulse Width Modulators A and B
LDD
STD
LDAB
STAB
STAB
#$0064
PWMC
#$80
PWMA
PWMB
;set PWM prescaler to div by 128
;set PWMA fast (512 Hz)
;and PWMB slow (4 Hz)
;set 50% duty cycle
;in PWMA
;in PWMB
*
Set up the Pulse Accumulator
LDD
#$5000
STD
PACTL
;set PAC to sense rising edges in
;event counting mode
*
Other Initializations
LDAB
TBXK
PAOV_CNT EQU
LDAB
TBZK
LDZ
LDAB
STAB
ANDP
#$00
0
#$01
#$0000
#$0A
PAOV_CNT,Z
#$FF1F
;set XK to bank 0 for STRING access
;counter variable for PAOV_ROUTINE
;PAOV_CNT will be indexed off ZK:IZ
;load a 10 into the variable
;set interrupt priority mask level to 0
***** Start of main program *****
GO:
NOP
BRA
GO
***** Subroutines *****
;Let's loop until we're interrupted
SEND_STRING:
EVEN
string
LDAB 0,X
BEQ
STRING_DONE
JSR
SEND_CH
AIX
#$01
BRA
SEND_STRING
STRING_DONE:
RTS
SEND_CH:
LDAA SCSR
;subroutine to send out the entire ASCII
;get next byte in string as pointed to by IX
;if B=00, then the string is 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
;subroutine to send out one byte to SCI
;read SCI status reg to check/clear TDRE bit
M68HC16 Z SERIES
USER’S MANUAL
INITIALIZATION AND PROGRAMMING EXAMPLES
For More Information On This Product,
Go to: www.freescale.com
E-27