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 [2021/10/08 14:19] – frtt | 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 55: | Line 30: | ||
| |::: | |::: | ||
| - | ==== SMCR ==== | + | ==== TIMx_SMCR - Slave mode control register |
| - | + | ||
| - | Slave mode control register | + | |
| \\ {{timer_reg_smcr.svg}} \\ \\ | \\ {{timer_reg_smcr.svg}} \\ \\ | ||
| Line 81: | Line 54: | ||
| |::: | |::: | ||
| - | ==== PSC ==== | + | ==== TIMx_PSC - Prescaler register |
| - | + | ||
| - | 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 95: | Line 64: | ||
| ===== Data Registers ===== | ===== Data Registers ===== | ||
| - | ==== CNT ==== | + | ==== TIMx_CNT - Count register |
| - | + | ||
| - | Count register | + | |
| \\ {{timer_reg_cnt.svg}} \\ \\ | \\ {{timer_reg_cnt.svg}} \\ \\ | ||
| - | ===== Legend | + | ===== Programming Example |
| - | \\ {{legende.svg}} \\ \\ | + | The code snippet below shows how to configure and use a timer. |
| + | |||
| + | <code c> | ||
| + | #include " | ||
| + | |||
| + | RCC-> | ||
| + | |||
| + | /* configure timer */ | ||
| + | TIM2-> | ||
| + | TIM2-> | ||
| + | |||
| + | TIM2-> | ||
| + | </ | ||
| + | \\ | ||