23.04.2013 Views

TMPM330 - Keil

TMPM330 - Keil

TMPM330 - Keil

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

8.3.4 Capture<br />

Under development<br />

<strong>TMPM330</strong> (rev 0.4)8-25<br />

<strong>TMPM330</strong><br />

This is a circuit that controls the timing of latching values from the UC0 up-counter into the<br />

TB0CP0 and TB0CP1 capture registers. The timing with which to latch data is specified by<br />

TB0MOD .<br />

Software can also be used to import values from the UC0 up-counter into the capture register;<br />

specifically, UC0 values are taken into the TB0CP0 capture register each time “0” is written to<br />

TB0MOD. To use this capability, the prescaler must be running<br />

(TB0RUN = “1”).<br />

8.3.5 Capture Registers (TB0CP0H/L, TB0CP1H/L)<br />

These are 16-bit registers for latching values from the UC0 up-counter. To read data from the<br />

capture register, use a 16-bit data transfer instruction or read in the order of low-order bits<br />

followed by high-order bits.<br />

8.3.6 Up-counter capture register (TB0UCH/L)<br />

Other than the capturing functions shown above, the current count value of the UC0 can be captured<br />

by reading the TB0UC registers.<br />

8.3.7 Comparators (CP0, CP1)<br />

These are 16-bit comparators for detecting a match by comparing set values of the UC0<br />

up-counter with set values of the TB0RG0 and TB0RG1 timer registers. If a match is detected,<br />

INTTB0 is generated.<br />

8.3.8 Timer Flip-flop (TB0FF0)<br />

The timer flip-flop (TB0FF0) is reversed by a match signal from the comparator and a latch<br />

signal to the capture registers. It can be enabled or disabled to reverse by setting the<br />

TB0FFCR.<br />

The value of TB0FF0 becomes undefined after a reset. The flip-flop can be reversed by<br />

writing “00” to TB0FFCR. It can be set to “1” by writing “01,” and can be cleared<br />

to “0” by writing “10.”<br />

The value of TB0FF0 can be output to the timer output pin, TB0OUT (shared with PI0). To<br />

enable timer output, the port I related registers PICR and PIFR1 must be programmed<br />

beforehand.<br />

8.3.9 Capture interrupt (INTCAP00, INTCAP01)<br />

Interrupts INTCAP00 and INTCAP01 can be generated at the timing of latching values from<br />

the UC0 up-counter into the TB0CP0 and TB0CP1 capture registers. The interrupt timing is<br />

specified by NVIC.<br />

16-bit Timer/<br />

Event Counters (TMRBs)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!