Motorola MC68340 manual Period Measurement

Models: MC68340

1 441
Download 441 pages 2.45 Kb
Page 357
Image 357

Freescale Semiconductor, Inc.

Freescale Semiconductor, Inc.

causes the counter to reload with $FFFF. TOUTx transitions at timeout or is disabled as programmed by the CR OCx bits. The SR OUT bit reflects the level on TOUTx.

To determine the number of cycles counted, the value in the CNTR must be read, inverted, and incremented by 1 (the first count is $FFFF which, in effect, includes a count of zero). The counter counts in a true 216 fashion. For measuring pulses of even greater duration, the value in the POx bits in the SR is readable and can be thought of as an extension of the least significant bits in the CNTR.

NOTE

Once the timer has been enabled, do not clear the SR TG bit until the pulse has been measured and TGATEhas been negated.

8.3.6 Period Measurement

This mode is used to count the period of a particular event. The event is defined by the assertion, negation, and subsequent reassertion of TGATE. When TGATEis asserted, the counter begins counting down from $FFFF. The negation of TGATEhas no effect on the counter. When TGATEis reasserted, the counter stops counting and holds the value at which it stopped. Further assertions and negations of TGATEhave no effect on the counter. This mode can be selected by programming the CR MODEx bits to 101.

The timer is enabled by setting the SWR, CPE, and the TGE bits in the CR. The assertion of TGATEstarts the counter. When the timer is enabled, the SR ON bit is set. On the next falling edge of the counter clock, the counter is loaded with the value of $FFFF. With each successive falling edge of the counter clock, the counter decrements. The PREL1 and PREL2 registers are not used in this mode.

The first negation of TGATEis ignored, but on the second assertion of TGATE, the SR TG bit is set, the SR ON bit is negated, and the prescaler and counter are disabled. Subsequent transitions on TGATEdo not re-enable the counter. See Figure 8-9 for a depiction of this mode. The SR TGL bit reflects the level of TGATEat all times.

MOTOROLAMC68340 USER’S MANUAL8- 13

For More Information On This Product,

Go to: www.freescale.com

Page 357
Image 357
Motorola MC68340 manual Period Measurement