| データシートサーチシステム |
|
AN4062 データシート(PDF) 13 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN4062 データシート(HTML) 13 Page - STMicroelectronics |
|
13 / 17 page ![]() DocID022897 Rev 3 13/17 AN4062 Peripheral firmware examples description 3.16 TIM PWM input example Purpose This example shows how to use the TIM peripheral to measure the frequency and duty cycle of an external signal. Description The TIMxCLK frequency is set to SystemCoreClock, the Prescaler is 0 so the counter clock is SystemCoreClock. SystemCoreClock is set to 48 MHz for STM32F0xx Devices. TIM2 is configured in PWM Input Mode: the external signal is connected to TIM2 Channel2 used as an input pin. To measure the frequency and the duty cycle, we use the TIM2 CC2 interrupt request, so that the frequency and the duty cycle of the external signal are computed In the TIM2_IRQHandler routine. The “Frequency” variable contains the external signal frequency: • TIM2 counter clock = SystemCoreClock, • Frequency = TIM2 counter clock / TIM2_CCR2 in Hz, The “DutyCycle” variable contains the external signal duty cycle: – DutyCycle = (TIM2_CCR1*100)/(TIM2_CCR2) in %. The minimum frequency value to measure is 732 Hz (TIM2 counter clock / CCR MAX). Note: Connect the external signal to measure the TIM2 CH2 pin (PA.01). 3.17 TIM PWM output example Purpose This example shows how to configure the TIM1 peripheral to generate PWM signals with 4 different duty cycles (50%, 37.5%, 25% and 12.5%). Description The TIMxCLK frequency is set to SystemCoreClock, the Prescaler is 0 so the counter clock is SystemCoreClock. SystemCoreClock is set to 48 MHz for STM32F0xx Devices. |
|
|
リンク 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 |