
DMA Timers (DTIM0–DTIM3)
29-10
Freescale Semiconductor
DTCN1 EQU 0xFC07_400C ;Timer1 counter register
DTER0 EQU 0xFC07_0003 ;Timer0 event register
DTER1 EQU 0xFC07_4003 ;Timer1 event register
* TMR0 is defined as: *
*[PS] = 0xFF,
divide clock by 256
*[CE] = 00
disable capture event output
*[OM] = 0
output=active-low pulse
*[ORRI] = 0,
disable ref. match output
*[FRR] = 1,
restart mode enabled
*[CLK] = 10,
internal bus clock/16
*[RST] = 0,
timer0 disabled
move.w #0xFF0C,D0
move.w D0,TMR0
move.l #0x0000,D0;writing to the timer counter with any
move.l DO,TCN0 ;value resets it to zero
move.l #0xAFAF,DO ;set the timer0 reference to be
move.l #D0,TRR0 ;defined as 0xAFAF
The simple example below uses Timer0 to count time-out loops. A time-out occurs when the reference
value, 0xAFAF, is reached.
timer0_ex
clr.l DO
clr.l D1
clr.l D2
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
29.4.2
Calculating Time-Out Values
determines time-out periods for various reference values:
Eqn. 29-1
When calculating time-out periods, add 1 to the prescaler to simplify calculating, because
DTMR
n
[PS] equals 0x00 yields a prescaler of 1, and DTMR
n
[PS] equals 0xFF yields a prescaler of 256.
Timeout period
1 clock frequency
⁄
(
)
1 or 16
(
)
×
DTMR
n
[PS]
1
+
(
)
×
DTRR
n
[REF]
1
+
(
)
×
=
MCF5329 Reference Manual, Rev 3
Содержание MCF5329
Страница 106: ...ColdFire Core 3 32 Freescale Semiconductor MCF5329 Reference Manual Rev 3...
Страница 126: ...Enhanced Multiply Accumulate Unit EMAC 4 20 Freescale Semiconductor MCF5329 Reference Manual Rev 3...
Страница 148: ...Cache 5 22 Freescale Semiconductor MCF5329 Reference Manual Rev 3...
Страница 154: ...Static RAM SRAM 6 6 Freescale Semiconductor MCF5329 Reference Manual Rev 3...
Страница 184: ...Power Management 8 18 Freescale Semiconductor MCF5329 Reference Manual Rev 3...
Страница 204: ...Reset Controller Module 10 8 Freescale Semiconductor MCF5329 Reference Manual Rev 3...
Страница 220: ...System Control Module SCM 11 16 Freescale Semiconductor MCF5329 Reference Manual Rev 3...
Страница 228: ...Crossbar Switch XBS 12 8 Freescale Semiconductor MCF5329 Reference Manual Rev 3...
Страница 268: ...General Purpose I O Module 13 40 Freescale Semiconductor MCF5329 Reference Manual Rev 3...
Страница 392: ...SDRAM Controller SDRAMC 18 30 Freescale Semiconductor MCF5329 Reference Manual Rev 3...
Страница 436: ...Fast Ethernet Controller FEC 19 44 Freescale Semiconductor MCF5329 Reference Manual Rev 3...
Страница 564: ...Liquid Crystal Display Controller LCDC 22 44 Freescale Semiconductor MCF5329 Reference Manual Rev 3...
Страница 594: ...FlexCAN 23 30 Freescale Semiconductor MCF5329 Reference Manual Rev 3...
Страница 678: ...Pulse Width Modulation PWM Module 26 22 Freescale Semiconductor MCF5329 Reference Manual Rev 3...
Страница 684: ...Watchdog Timer Module 27 6 Freescale Semiconductor MCF5329 Reference Manual Rev 3...
Страница 692: ...Programmable Interrupt Timers PIT0 PIT3 28 8 Freescale Semiconductor MCF5329 Reference Manual Rev 3...
Страница 704: ...DMA Timers DTIM0 DTIM3 29 12 Freescale Semiconductor MCF5329 Reference Manual Rev 3...
Страница 720: ...Queued Serial Peripheral Interface QSPI 30 16 Freescale Semiconductor MCF5329 Reference Manual Rev 3...
Страница 754: ...UART Modules 31 34 Freescale Semiconductor MCF5329 Reference Manual Rev 3...
Страница 770: ...I2 C Interface 32 16 Freescale Semiconductor MCF5329 Reference Manual Rev 3...
Страница 790: ...Message Digest Hardware Accelerator MDHA 33 20 Freescale Semiconductor MCF5329 Reference Manual Rev 3...
Страница 866: ...Debug Module 36 50 Freescale Semiconductor MCF5329 Reference Manual Rev 3...
Страница 902: ...Register Memory Map Quick Reference A 26 Freescale Semiconductor MCF5329 Reference Manual Rev 3...