09.12.2012 Views

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

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>RM0090</strong> General-purpose timers (TIM9 to TIM14)<br />

Figure 167. Counter timing diagram with prescaler division change from 1 to 2<br />

Figure 168. Counter timing diagram with prescaler division change from 1 to 4<br />

16.4.2 Counter modes<br />

Upcounting mode<br />

CK_PSC<br />

CEN<br />

Timer clock = CK_CNT<br />

Counter register<br />

Update event (UEV)<br />

F7<br />

F8 F9 FA FB FC<br />

Prescaler control register 0 1<br />

Write a new value in TIMx_PSC<br />

Prescaler buffer 0 1<br />

Prescaler counter 0 0 1 0 1 0 1 0 1<br />

CK_PSC<br />

CEN<br />

Timer clock = CK_CNT<br />

Counter register<br />

Update event (UEV)<br />

F7<br />

In upcounting mode, the counter counts from 0 to the auto-reload value (content of the<br />

TIMx_ARR register), then restarts from 0 and generates a counter overflow event.<br />

Setting the UG bit in the TIMx_EGR register (by software or by using the slave mode<br />

controller on TIM9 and TIM12) also generates an update event.<br />

The UEV event can be disabled by software by setting the UDIS bit in the TIMx_CR1<br />

register. This is to avoid updating the shadow registers while writing new values in the<br />

preload registers. Then no update event occurs until the UDIS bit has been written to 0.<br />

However, the counter restarts from 0, as well as the counter of the prescaler (but the<br />

prescale rate does not change). In addition, if the URS bit (update request selection) in<br />

TIMx_CR1 register is set, setting the UG bit generates an update event UEV but without<br />

00<br />

01 02 03<br />

F8 F9 FA FB FC 00<br />

01<br />

Prescaler control register 0 3<br />

Write a new value in TIMx_PSC<br />

Prescaler buffer 0 3<br />

Prescaler counter 0 0 1 2 3 0 1 2 3<br />

Doc ID 018909 Rev 3 482/1416

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

Saved successfully!

Ooh no, something went wrong!