
MOTOROLA
8-20
CTM
REFERENCE
DOUBLE ACTION SUBMODULE (DASM)
For More Information On This Product,
Go to: www.freescale.com
8
8.7
DASM examples
8.7.1
IC mode example
****************************************************************************
*
*
DASM_IC (for CPU16 based devices)
*
*
Demonstration of the DASM CTM sub-module operating in IC mode.
*
The DASM is configured to capture the first falling input edge,
*
then generate an interrupt.
*
*
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)
ldd
std
#$0900
dasm10sic
; MODE = %0000 = DIS
; Disable DASM module before re-configuring
* Ensure that CPU will respond to a level 1 interrupt
andp
#$FF1F
; AND CCR with $FF1F to clear interrupt mask
* DASM IC mode initialization
ldd
#$1913
; MODE = %0011
; EDPOL = 1
; BSL = 1
; IARB3 = 1
; IL = %001
Select IC mode
Capture -ve edge
Use time base bus B
Lowest priority interrupt
std
bra
dasm10sic
loop
loop
; Hang here (until interrupt)
***********************************************************************
*
*
IC1 interrupt routine.
*
The interrupt vector for the DASM module should
*
contain the entry address <ic1>
*
***********************************************************************
ic1
bclr
lde
rti
dasm10sic,#$80
dasm10a
; Clear DASM FLAG
; Get the edge time into e
; Return from interrupt
F
.
Freescale Semiconductor, Inc.