
MOTOROLA
8-24
CTM
REFERENCE
DOUBLE ACTION SUBMODULE (DASM)
For More Information On This Product,
Go to: www.freescale.com
8
8.7.4
PWM mode example
****************************************************************************
*
*
DASM_PWM (for CPU16 based devices)
*
*
Demonstration of the DASM CTM sub-module operating in 7-bit PWM mode.
*
Data shown for generating PWM duty cycles from 0% to 100%
*
*
Timings assume 16.777MHz system clock
*
****************************************************************************
* Set up the bus interface unit sub-module, BIUSM
ldd
#$0C01
std
BIUMCR
; CTM not stopped, ignore FREEZE,
; vector base =$4x, IARB2-0=4, BUS B displayed
* Set up the counter prescaler module, CPSM
ldd
#$0008
std
CPCR
; Set PRUN to start prescaler and set
; PCLK dividers to /2 /4 /8 /16 /32 and /64
* Set up the free running counter module, FCSM
ldd
#$0905
std
fcsm25sic
; No interrupts, arb3=1, timebase B driven
; Clock using PCLK6 (/64 clock, 3.8147
μ
s)
* DASM PWM mode initialization
ldd
std
#$0900
dasm10sic
; MODE = %0000 = DIS
; Disable DASM module before re-configuring
ldd
#$090F
; MODE = %1111
; EDPOL = 0
; FORCA,B = 0
; BSL = 1
; WOR = 0
; IARB3 = 1
; IL = %000
Select 7-bit OPWM mode
Generate positive pulse
Don't force pin now
Use time base bus B
Totem pole output
Interrupts disabled
std
ldd
std
dasm10sic
#$0000
dasm10a
; A edge at $0000
ldd
#$0040
; B edge at $0040, 64/128 = 50% duty cycle
; Other example PWM values:
; B edge at $0000, 0/128 = 0% duty cycle
; B edge at $0001, 1/128 = 0.78% duty cycle
; B edge at $007F, 127/128 = 99.2% duty cycle
; Special case, bit 15 set = 1002% duty cycle
*
*
*
*
*
ldd
ldd
ldd
ldd
std
#$0000
#$0001
#$007F
#$8000
dasm10b
F
.
Freescale Semiconductor, Inc.