28.10.2014 Views

MMC2107 - Freescale Semiconductor

MMC2107 - Freescale Semiconductor

MMC2107 - Freescale Semiconductor

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Freescale</strong> <strong>Semiconductor</strong>, Inc.<br />

Timer Modules (TIM1 and TIM2)<br />

Functional Description<br />

15.8.5 General-Purpose I/O Ports<br />

An I/O pin used by the timer defaults to general-purpose I/O unless an<br />

internal function which uses that pin is enabled.<br />

The timer pins can be configured for either an input capture function or<br />

an output compare function. The IOSx bits in the timer IC/OC select<br />

register configure the timer port pins as either input capture or output<br />

compare pins.<br />

nc...<br />

<strong>Freescale</strong> <strong>Semiconductor</strong>, I<br />

The timer port data direction register controls the data direction of an<br />

input capture pin. External pin conditions trigger input captures on input<br />

capture pins configured as inputs.<br />

To configure a pin for input capture:<br />

1. Clear the pin’s IOS bit in TIMIOS.<br />

2. Clear the pin’s DDR bit in TIMDDR.<br />

3. Write to TIMCTL2 to select the input edge to detect.<br />

TIMDDR does not affect the data direction of an output compare pin. The<br />

output compare function overrides the data direction register but does<br />

not affect the state of the data direction register.<br />

To configure a pin for output compare:<br />

1. Set the pin’s IOS bit in TIMIOS.<br />

2. Write the output compare value to TIMCxH/L.<br />

3. Clear the pin’s DDR bit in TIMDDR.<br />

4. Write to the OMx/OLx bits in TIMCTL1 to select the output action.<br />

Data Direction<br />

Register<br />

In<br />

Table 15-7. TIMPORT I/O Function<br />

Output Compare<br />

Action<br />

Reading<br />

at Data Bus<br />

Out<br />

Reading at Pin<br />

0 0 Pin Pin<br />

0 1 Pin Output compare action<br />

1 1 Port data register Output compare action<br />

1 0 Port data register Port data register<br />

<strong>MMC2107</strong> – Rev. 2.0<br />

Technical Data<br />

MOTOROLA Timer Modules (TIM1 and TIM2) 325<br />

For More Information On This Product,<br />

Go to: www.freescale.com

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

Saved successfully!

Ooh no, something went wrong!