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.

Advanced-control timers (TIM1&TIM8) <strong>RM0090</strong><br />

Figure 99. Output stage of capture/compare channel (channel 1 to 3)<br />

ETR<br />

CNT>CCR1<br />

Output mode OC1REF<br />

CNT=CCR1 controller<br />

OC1CE OC1M[2:0]<br />

TIM1_CCMR1<br />

Figure 100. Output stage of capture/compare channel (channel 4)<br />

ETR<br />

CNT > CCR4<br />

Output mode<br />

CNT = CCR4 controller<br />

OC2M[2:0]<br />

TIM1_CCMR2<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 />

14.3.6 Input capture mode<br />

OC4 REF<br />

To the master mode<br />

controller<br />

‘0’<br />

Dead-time<br />

generator<br />

DTG[7:0]<br />

TIM1_BDTR<br />

OC1_DT<br />

OC1N_DT<br />

To the master mode<br />

controller<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 />

cleared by software by writing it to ‘0’ or by reading the captured data stored in the<br />

TIMx_CCRx register. CCxOF is cleared when you write it to ‘0’.<br />

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

‘0’<br />

x0<br />

01<br />

11<br />

11<br />

10<br />

0x<br />

CC1NECC1E<br />

TIM1_CCER<br />

0<br />

1<br />

CC1P<br />

TIM1_CCER<br />

0<br />

1<br />

Output<br />

enable<br />

circuit<br />

Output<br />

enable<br />

circuit<br />

OC1<br />

OC1N<br />

CC1NE CC1E TIM1_CCER<br />

CC1NP MOEOSSI OSSRTIM1_BDTR<br />

TIM1_CCER<br />

0<br />

1<br />

CC4P<br />

TIM1_CCER<br />

Output<br />

enable<br />

circuit<br />

OC4<br />

CC4E TIM1_CCER<br />

MOEOSSI<br />

TIM1_BDTR<br />

OIS4<br />

TIM1_CR2

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

Saved successfully!

Ooh no, something went wrong!