09.12.2012 Views

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

<strong>RM0090</strong> General-purpose timers (TIM9 to TIM14)<br />

Figure 179. Capture/compare channel 1 main circuit<br />

read CCR1H S<br />

read CCR1L<br />

R<br />

CC1S[1]<br />

CC1S[0]<br />

IC1PS<br />

CC1E<br />

CC1G<br />

TIM1_EGR<br />

read_in_progress<br />

input<br />

mode<br />

Figure 180. Output stage of capture/compare channel (channel 1)<br />

CNT > CCR1<br />

Output mode<br />

CNT = CCR1 controller<br />

OC1M[2:0]<br />

TIMx_CCMR1<br />

The capture/compare block is made of one preload register and one shadow register. Write<br />

and read always access the preload register.<br />

In capture mode, captures are actually done in the shadow register, which is copied into the<br />

preload register.<br />

In compare mode, the content of the preload register is copied into the shadow register<br />

which is compared to the counter.<br />

16.4.5 Input capture mode<br />

Capture/compare preload register<br />

capture_transfer<br />

OC1_REF<br />

Capture/compare shadow register<br />

capture<br />

APB Bus<br />

MCU-peripheral interface<br />

high<br />

(if 16-bit)<br />

8 8<br />

Counter<br />

low<br />

compare_transfer<br />

To the master mode<br />

controller<br />

write_in_progress<br />

comparator<br />

output<br />

mode<br />

CNT>CCR1<br />

CNT=CCR1<br />

CC1S[1]<br />

CC1S[0]<br />

In Input capture mode, the Capture/Compare Registers (TIMx_CCRx) are used to latch the<br />

value of the counter after a transition detected by the corresponding ICx signal. When a<br />

capture occurs, the corresponding CCXIF flag (TIMx_SR register) is set and an interrupt or<br />

a DMA request can be sent if they are enabled. If a capture occurs while the CCxIF flag was<br />

already high, then the over-capture flag CCxOF (TIMx_SR register) is set. CCxIF can be<br />

Doc ID 018909 Rev 3 488/1416<br />

0<br />

1<br />

CC1P<br />

TIMx_CCER<br />

S<br />

R<br />

write CCR1H<br />

write CCR1L<br />

OC1PE<br />

OC1PE<br />

UEV<br />

(from time<br />

base unit)<br />

TIM1_CCMR1<br />

Output<br />

enable<br />

circuit<br />

OC1<br />

CC1E TIMx_CCER<br />

ai17720

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

Saved successfully!

Ooh no, something went wrong!