Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| stm32:peripherals:timer_base [2017/01/09 13:14] – [Programming Example] kesr | stm32:peripherals:timer_base [2023/10/19 09:49] (current) – frtt | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| \\ {{timer_base.svg}} \\ \\ | \\ {{timer_base.svg}} \\ \\ | ||
| - | |||
| - | ===== Programming Example ===== | ||
| - | |||
| - | The code snippet bellow shows how to configure and use a GPIO pin as input. | ||
| - | |||
| - | <code c> | ||
| - | #include " | ||
| - | |||
| - | RCC-> | ||
| - | |||
| - | /* configure timer */ | ||
| - | TIM2-> | ||
| - | TIM2-> | ||
| - | |||
| - | TIM2-> | ||
| - | </ | ||
| - | \\ | ||
| - | |||
| - | > {{logo_hal.svg? | ||
| - | > [[https:// | ||
| - | > [[https:// | ||
| - | \\ | ||
| ===== Configuration Registers ===== | ===== Configuration Registers ===== | ||
| - | ==== CR1 ==== | + | ==== TIMx_CR1 - Configuration register 1 ==== |
| - | + | ||
| - | Configuration register 1 | + | |
| \\ {{timer_reg_cr1.svg}} \\ \\ | \\ {{timer_reg_cr1.svg}} \\ \\ | ||
| Line 41: | Line 17: | ||
| |::: | |::: | ||
| //*This bit is readonly in center-aligned or encoder mode// \\ | //*This bit is readonly in center-aligned or encoder mode// \\ | ||
| - | ==== DIER ==== | ||
| - | DMA / Interrupt enable register | + | ==== TIMx_DIER - DMA / Interrupt enable register |
| \\ {{timer_reg_dier.svg}} \\ \\ | \\ {{timer_reg_dier.svg}} \\ \\ | ||
| Line 50: | Line 25: | ||
| |UDE|0|Update DMA request disabled (reset state)| | |UDE|0|Update DMA request disabled (reset state)| | ||
| |::: | |::: | ||
| + | |CC1IE|0|CC1 interrupt disabled (reset state)| | ||
| + | |:::|1|CC1 interrupt enabled| | ||
| |UIE|0|Update interrupt disabled (reset state)| | |UIE|0|Update interrupt disabled (reset state)| | ||
| |::: | |::: | ||
| - | ==== SMCR ==== | + | ==== TIMx_SMCR - Slave mode control register |
| - | + | ||
| - | Slave mode control register | + | |
| \\ {{timer_reg_smcr.svg}} \\ \\ | \\ {{timer_reg_smcr.svg}} \\ \\ | ||
| |< 100% 5em 5em 20em 5em >| | |< 100% 5em 5em 20em 5em >| | ||
| + | |ECE|0|External clock mode 2 disabled (reset state)|| | ||
| + | |::: | ||
| + | |ETF|0000|No filter, f< | ||
| + | |::: | ||
| + | |::: | ||
| + | |::: | ||
| + | |::: | ||
| + | |::: | ||
| + | |::: | ||
| + | |::: | ||
| + | |TS |000|Internal Trigger 0 (ITR0) (reset state)|100| TI1 Edge Detector (TI1F_ED)| | ||
| + | |::: | ||
| + | |::: | ||
| + | |::: | ||
| |SMS|000|Slave mode disabled (reset state)|100|Reset mode| | |SMS|000|Slave mode disabled (reset state)|100|Reset mode| | ||
| |::: | |::: | ||
| |::: | |::: | ||
| |::: | |::: | ||
| - | |ECE|0|External clock mode 2 disabled (reset state)|| | ||
| - | |::: | ||
| - | |||
| - | ==== PSC ==== | ||
| - | Prescaler register | + | ==== TIMx_PSC - Prescaler register |
| \\ {{timer_reg_psc.svg}} \\ \\ | \\ {{timer_reg_psc.svg}} \\ \\ | ||
| - | ==== ARR ==== | + | ==== TIMx_ARR - Auto reload register |
| - | + | ||
| - | Auto reload register | + | |
| \\ {{timer_reg_arr.svg}} \\ \\ | \\ {{timer_reg_arr.svg}} \\ \\ | ||
| Line 81: | Line 64: | ||
| ===== Data Registers ===== | ===== Data Registers ===== | ||
| - | ==== CNT ==== | + | ==== TIMx_CNT - Count register |
| - | + | ||
| - | Count register | + | |
| \\ {{timer_reg_cnt.svg}} \\ \\ | \\ {{timer_reg_cnt.svg}} \\ \\ | ||
| - | ===== Legend | + | ===== Programming Example |
| + | |||
| + | The code snippet below shows how to configure and use a timer. | ||
| + | |||
| + | <code c> | ||
| + | #include " | ||
| - | \\ {{legende.svg}} \\ \\ | + | RCC-> |
| + | |||
| + | /* configure timer */ | ||
| + | TIM2-> | ||
| + | TIM2-> | ||
| + | |||
| + | TIM2-> | ||
| + | </ | ||
| + | \\ | ||