21-10
MCF5282 User’s Manual
MOTOROLA
Using the DMA Timer Modules
move.l #0x0000,D0
move.l D0,TCN0
;reset the counter to 0x0000
move.b #0x03,D0 ;writing ones to TER0[REF,CAP]
move.b D0,TER0
;clears the event flags
move.w TMR0,D0
;save the contents of TMR0 while setting
bset #0,D0
;the 0 bit. This enables timer 0 and starts counting
move.w D0,TMR0
;load the value back into the register, setting TMR0[RST]
T0_LOOP
move.b TER0,D1
;load TER0 and see if
btst #1,D1
;TER0[REF] has been set
beq T0_LOOP
addi.l #1,D2
;Increment D2
cmp.l #5,D2
;Did D2 reach 5? (i.e. timer ref has timed)
beq T0_FINISH
;If so, end timer0 example. Otherwise jump back.
move.b #0x02,D0
;writing one to TER0[REF] clears the event flag
move.b D0,TER0
jmp T0_LOOP
T0_FINISH
HALT
;End processing. Example is finished
21.3.2 Calculating Time-Out Values
The formula below determines time-out periods for various reference values:
Time-out period = (1/clock frequency) x (1 or 16) x (DTMR
n
[PS] + 1) x (DTRR
n
[REF])
When calculating time-out periods, add 1 to the prescaler to simplify calculating, because
DTMR
n
[PS] = 0x00 yields a prescaler of 1 and DTMR
n
[PS] = 0xFF yields a prescaler of
256. For example, if a 66-MHz timer clock is divided by 16, DTMR
n
[PS] = 0x7F, and the
timer is referenced at 0xFBC5 (64,453 decimal), the time-out period is as follows:
Time-out period = [1/(66 x 10
6
) x (16) x (127 + 1) x (64,453) = 2.00 s
Summary of Contents for ColdFire MCF5281
Page 124: ...3 20 MCF5282 User s Manual MOTOROLA EMAC Instruction Set Summary ...
Page 141: ...MOTOROLA Chapter 5 Static RAM SRAM 5 5 SRAM Programming Model ...
Page 142: ...5 6 MCF5282 User s Manual MOTOROLA SRAM Programming Model ...
Page 168: ...6 26 MCF5282 User s Manual MOTOROLA Interrupts ...
Page 186: ...7 18 MCF5282 User s Manual MOTOROLA Functional Description ...
Page 228: ...9 22 MCF5282 User s Manual MOTOROLA Functional Description ...
Page 246: ...10 18 MCF5282 User s Manual MOTOROLA Low Power Wakeup Operation ...
Page 254: ...11 8 MCF5282 User s Manual MOTOROLA Memory Map and Registers ...
Page 264: ...12 10 MCF5282 User s Manual MOTOROLA Chip Select Registers ...
Page 280: ...13 16 MCF5282 User s Manual MOTOROLA Misaligned Operands ...
Page 314: ...14 34 MCF5282 User s Manual MOTOROLA MCF5282 External Signals ...
Page 339: ...MOTOROLA Chapter 15 Synchronous DRAM Controller Module 15 25 SDRAM Example ...
Page 340: ...15 26 MCF5282 User s Manual MOTOROLA SDRAM Example ...
Page 356: ...16 16 MCF5282 User s Manual MOTOROLA DMA Controller Module Functional Description ...
Page 408: ...17 52 MCF5282 User s Manual MOTOROLA Buffer Descriptors ...
Page 446: ...20 24 MCF5282 User s Manual MOTOROLA Interrupts ...
Page 474: ...22 18 MCF5282 User s Manual MOTOROLA Programming Model ...
Page 510: ...23 36 MCF5282 User s Manual MOTOROLA Operation ...
Page 526: ...24 16 MCF5282 User s Manual MOTOROLA I2C Programming Examples ...
Page 672: ...28 12 MCF5282 User s Manual MOTOROLA Functional Description ...
Page 718: ...29 46 MCF5282 User s Manual MOTOROLA Motorola Recommended BDM Pinout ...
Page 750: ...32 8 MCF5282 User s Manual MOTOROLA Ordering Information ...