29.01.2015 Views

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

General-purpose timer (TIMx)<br />

RM0008<br />

Bits 9:8 CC2S[1:0]: Capture/Compare 2 selection<br />

This bit-field defines the direction of the channel (input/output) as well as the used input.<br />

00: CC2 channel is configured as output.<br />

01: CC2 channel is configured as input, IC2 is mapped on TI2.<br />

10: CC2 channel is configured as input, IC2 is mapped on TI1.<br />

11: CC2 channel is configured as input, IC2 is mapped on TRC. This mode is working only<br />

if an internal trigger input is selected through the TS bit (TIMx_SMCR register)<br />

Note: CC2S bits are writable only when the channel is OFF (CC2E = ’0’ in TIMx_CCER).<br />

Bit 7 OC1CE: Output compare 1 clear enable<br />

OC1CE: Output Compare 1 Clear Enable<br />

0: OC1Ref is not affected by the ETRF input<br />

1: OC1Ref is cleared as soon as a High level is detected on ETRF input<br />

Bits 6:4 OC1M: Output compare 1 mode<br />

These bits define the behavior of the output reference signal OC1REF from which OC1 <strong>and</strong><br />

OC1N are derived. OC1REF is active high whereas OC1 <strong>and</strong> OC1N active level depends<br />

on CC1P <strong>and</strong> CC1NP bits.<br />

000: Frozen - The comparison between the output compare register TIMx_CCR1 <strong>and</strong> the<br />

counter TIMx_CNT has no effect on the outputs.<br />

001: Set channel 1 to active level on match. OC1REF signal is forced high when the counter<br />

TIMx_CNT matches the capture/compare register 1 (TIMx_CCR1).<br />

010: Set channel 1 to inactive level on match. OC1REF signal is forced low when the<br />

counter TIMx_CNT matches the capture/compare register 1 (TIMx_CCR1).<br />

011: Toggle - OC1REF toggles when TIMx_CNT=TIMx_CCR1.<br />

100: Force inactive level - OC1REF is forced low.<br />

101: Force active level - OC1REF is forced high.<br />

110: PWM mode 1 - In upcounting, channel 1 is active as long as TIMx_CNTTIMx_CCR1 else active (OC1REF=’1’).<br />

111: PWM mode 2 - In upcounting, channel 1 is inactive as long as<br />

TIMx_CNTTIMx_CCR1 else inactive.<br />

Note: 1: These bits can not be modified as long as LOCK level 3 has been programmed<br />

(LOCK bits in TIMx_BDTR register) <strong>and</strong> CC1S=’00’ (the channel is configured in<br />

output).<br />

2: In PWM mode 1 or 2, the OCREF level changes only when the result of the<br />

comparison changes or when the output compare mode switches from “frozen” mode<br />

to “PWM” mode.<br />

Bit 3 OC1PE: Output compare 1 preload enable<br />

0: Preload register on TIMx_CCR1 disabled. TIMx_CCR1 can be written at anytime, the<br />

new value is taken in account immediately.<br />

1: Preload register on TIMx_CCR1 enabled. Read/Write operations access the preload<br />

register. TIMx_CCR1 preload value is loaded in the active register at each update event.<br />

Note: 1: These bits can not be modified as long as LOCK level 3 has been programmed<br />

(LOCK bits in TIMx_BDTR register) <strong>and</strong> CC1S=’00’ (the channel is configured in<br />

output).<br />

2: The PWM mode can be used without validating the preload register only in one<br />

pulse mode (OPM bit set in TIMx_CR1 register). Else the behavior is not guaranteed.<br />

364/995 Doc ID 13902 Rev 9

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

Saved successfully!

Ooh no, something went wrong!