| 전자부품 데이터시트 검색엔진 |
|
AN4013 데이터시트(PDF) 12 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN4013 데이터시트(HTML) 12 Page - STMicroelectronics |
|
12 / 37 page ![]() General-purpose timer modes AN4013 12/37 DocID022500 Rev 4 The update event is generated also by: Software, if the UG (update generation) bit is set in TIM_EGR register. Update generation through the slave mode controller As the buffered registers (ARR, PSC, CCRx) need an update event to be loaded with their preload values, set the URS (Update Request Source) to 1 to avoid the update flag each time these values are loaded. In this case, the update event is only generated if the counter overflow/underflow occurs. The update event can be also disabled by setting the bit UDIS (update disable) in the CR1 register. In this case, the update event is not generated, and shadow registers (ARR, PSC, CCRx) keep their value. The counter and the prescaler are reinitialized if the UG bit is set, or if a hardware reset is received from the slave mode controller. An interrupt or/ and a DMA request can be generated when the UIE bit or/and UDE bit are set in the DIER register. For more details on using the timer in this mode, refer to the examples provided in the STM32xx standard peripheral libraries in the /Project/STM32xx_StdPeriph_Examples/ TIM/TimeBase folder. STM32Cube F3 firmware package includes examples in the following directories: Projects\STM32F3348-Discovery\Examples\TIM\TIM_TimeBase, Projects\STM32F302R8-Nucleo\Examples\TIM\TIM_TimeBase, Projects\STM32F3-Discovery\Examples\TIM\TIM_TimeBase, Projects\STM32373C_EVAL\Examples\TIM\TIM_TimeBase, Projects\STM32303E_EVAL\Examples\TIM\TIM_TimeBase and Projects\STM32303C_EVAL\Examples\TIM\TIM_TimeBase 2.3 Timer input capture mode The timer can be used in input capture mode to measure an external signal. Depending on timer clock, prescaler and timer resolution, the maximum measured period is deduced. To use the timer in this mode: 1. Select the active input by setting the CCxS bits in CCMRx register. These bits should be different from zero, otherwise the CCRx register will be read only. 2. Program the filter by writing the IC1F[3:0] bits in the CCMRx register, and the prescaler by writing the IC1PSC[1:0] if needed. 3. Program the polarity by writing the CCxNP/CCxP bits to select between rising, falling or both edges. The input capture module is used to capture the value of the counter after a transition is detected by the corresponding input channel. To get the external signal period, two consecutive captures are needed. The period is calculated by subtracting these two values. Period = Capture(1) /(TIMx_CLK *(PSC+1)*(ICxPSC)*polarity_index(2)) The capture difference between two consecutive captures CCRx_tn and CCRx_tn+1: If CCRx_tn < CCRx_tn+1: capture = CCRx_tn+1 - CCRx_tn If CCRx_tn > CCRx_tn+1: capture = (ARR_max - CCRx_tn) + CCRx_tn+1 The polarity index is 1 if the rising or falling edge is used, and 2 if both edges are used. |
|
링크 URL |
| ALLDATASHEET 가 귀하에 도움이 되셨나요? [ DONATE ] |
Alldatasheet는? | 광고문의 | 운영자에게 연락하기 | 개인정보취급방침 | 링크 투 데이터시트 | 링크교환 | 제조사별 검색 All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |