Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
stm32:peripherals:timer_output [2016/06/28 11:29] – [Programming Example] feurstm32:peripherals:timer_output [2016/06/28 11:55] (current) – removed feur
Line 1: Line 1:
-====== Timer Output ====== 
  
-\\ {{timer_output.svg}} \\ \\ 
- 
-===== Programming Example ===== 
- 
-The code snippet bellow shows how to configure and use a GPIO pin as input. 
- 
-<code c> 
-#include "reg_stm32f4xx.h" 
- 
-RCC->AHB1ENR |= (0x1 <<  0u);         /* Enable GPIOA clock. */ 
-RCC->APB1ENR |= (0x1 << 0u);          /* Enable TIM2 clock. */ 
-  
-/* configure basic timer */ 
-TIM2->PSC = 84000u - 1u;              /* Counting with f = 84MHz / 84000 = 1MHz */ 
-TIM2->ARR = 512u;                     /* Count to 512 */ 
- 
-/* configure timer output */ 
-TIM2-> 
-  
-TIM2->CR1 |= (0x1 << 0u);             /* Start timer */ 
-</code> 
-\\ 
- 
-> {{logo_hal.svg?72px |}} **Hardware Abstraction Layer** 
-> [[https://ennis.zhaw.ch/hal/structreg__tim__t.html | Registry Types]] 
-> [[https://ennis.zhaw.ch/hal/hal__timer_8h.html | InES Timer HAL Interface]] 
-\\ 
- 
-===== Configuration Registers ===== 
- 
-==== CCMR1/2 ==== 
- 
-Capture/compare mode register 1/2 
- 
-\\ {{timer_reg_ccmr1.svg}} {{timer_reg_ccmr2.svg}} \\ \\ 
- 
-==== DIER ==== 
- 
-DMA / Interrupt enable register 
- 
-\\ {{timer_reg_dier.svg}} \\ \\ 
- 
-|< 100% 5em 5em >| 
-|CCxDE|0|CCx DMA request disabled (reset state)| 
-|:::  |1|CCx DMA request enabled| 
-|CCxIE|0|CCx interrupt disabled (reset state)| 
-|:::  |1|CCx interrupt enabled| 
- 
-==== CCER ==== 
- 
-Capture/compare enable register 
- 
-\\ {{timer_reg_ccer.svg}} \\ \\ 
- 
-|< 100% 5em 5em >| 
-|CCxE|0|Capture/compare output x disabled</sub>| 
-|:::|1|Capture/compare output x enabled| 
- 
- 
- 
-===== Legend ===== 
- 
-\\ {{legende.svg}} \\ \\ 
  • stm32/peripherals/timer_output.1467113374.txt.gz
  • Last modified: 2016/06/28 11:29
  • by feur