Enabling a Timer
14-12
ADSP-2126x SHARC Processor Hardware Reference
When the timer detects a first leading edge, it starts incrementing. When
it detects the trailing edge of a waveform, the timer captures the current
value of the Count register (=
TMxCNT
/2) and transfers it into the
TMxW
width registers. At the next leading edge, the timer transfers the current
value of the Count register (=
TMxCNT
/2) into the
TMxPRD
period register.
The Count registers are reset to 0x0000 0001 again, and the timer contin-
ues counting until it is either disabled or the count value reaches
0xFFFF FFFF.
In this mode, software can measure both the pulse width and the pulse
period of a waveform. To control the definition of the leading edge and
trailing edge of the
TIMERx
signal, the
PULSE
bit in the
TMxCTL
register is set
or cleared. If the
PULSE
bit is cleared, the measurement is initiated by a
falling edge, the Count register is captured to the Width register on the
rising edge, and the Period register is captured on the next falling edge.
The
PRDCNT
bit in the
TMxCTL
register controls whether an enabled inter-
rupt is generated when the pulse width or pulse period is captured. If the
PRDCNT
bit is set, the Interrupt Latch bit (
TIMxIRQ
) gets set when the pulse
period value is captured. If the
PRDCNT
bit is cleared, the
TIMxIRQ
bit gets
set when the pulse width value is captured.
If the
PRDCNT
bit is cleared, the first period value has not yet been mea-
sured when the first interrupt is generated. Therefore, the period value is
not valid. If the interrupt service routine reads the period value anyway,
the timer returns a period value of zero. When the period expires, the
period value is loaded in the
TMxPRD
register.
A timer interrupt (if enabled) is also generated if the Count register
reaches a value of 0xFFFF FFFF. At that point, the timer is disabled auto-
matically, and the
TIMxOVF
Status bit is set, indicating a count overflow.
The
TIMxIRQ
and
TMxOVF
bits are sticky bits, and software must explicitly
clear them.
Summary of Contents for ADSP-21261 SHARC
Page 30: ...Contents xxx ADSP 2126x SHARC Processor Hardware Reference ...
Page 40: ...Register Diagram Conventions xl ADSP 2126x SHARC Processor Hardware Reference ...
Page 58: ...Differences From Previous SHARCs 1 18 ADSP 2126x SHARC Processor Hardware Reference ...
Page 112: ...Secondary Processing Element PEy 2 54 ADSP 2126x SHARC Processor Hardware Reference ...
Page 178: ...Summary 3 66 ADSP 2126x SHARC Processor Hardware Reference ...
Page 204: ...DAG Instruction Summary 4 26 ADSP 2126x SHARC Processor Hardware Reference ...
Page 322: ...Setting Up DMA 7 32 ADSP 2126x SHARC Processor Hardware Reference ...
Page 436: ...SPORT Programming Examples 9 86 ADSP 2126x SHARC Processor Hardware Reference ...
Page 521: ...ADSP 2126x SHARC Processor Hardware Reference 11 31 Input Data Port rts IDP_ISR end ...
Page 522: ...Input Data Port Programming Example 11 32 ADSP 2126x SHARC Processor Hardware Reference ...
Page 590: ...Timer Programming Examples 14 20 ADSP 2126x SHARC Processor Hardware Reference ...
Page 796: ...I O Processor Registers A 174 ADSP 2126x SHARC Processor Hardware Reference ...
Page 800: ...B 4 ADSP 2126x SHARC Processor Core Manual ...
Page 846: ...Index I 36 ADSP 2126x SHARC Processor Hardware Reference ...