| công cụ tìm kiếm bảng dữ liệu linh kiện điện tử |
|
AN4157 bảng dữ liệu(PDF) 20 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN4157 bảng dữ liệu(HTML) 20 Page - STMicroelectronics |
|
20 / 24 page ![]() Peripheral firmware examples description AN4157 20/24 Doc ID 023629 Rev 1 3.23 TIM PWM input example 3.23.1 Purpose This example shows how to use the TIM peripheral to measure the frequency and duty cycle of an external signal. 3.23.2 Description TIMxclock (TIMxCLK) is SystemCoreClock, and TIMx prescalers are set to 0 so that TIMx counter clock is SystemCoreClock (72 MHz). 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, TIM2_CCR2 interrupt request is used, 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 915 Hz (TIM2 counter clock / CCR MAX). Note: Connect the external signal to measure the TIM2 CH2 pin (PA01). 3.24 TIM rettrigreable one pulse mode example 3.24.1 Purpose This example shows how to use the TIM peripheral to generate a Retrigerrable One pulse Mode after a Rising edge of an external signal is received in Timer Input pin. 3.24.2 Description In this example, we want to obtain aTIM2 counter clock of 36 MHz and a TIM2 inputs clock (TIM2CLK) equal to systemCoreClock (72 MHz): Prescaler = (TIM2CLK / TIM2 counter clock) - 1 The Autoreload value is 65535 (TIM2->ARR). Aa a result the maximum frequency to trigger the TIM2 input is: 36000000/65535 = 549.3 Hz. |
|
|
Link URL |
| Cho đến nay ALLDATASHEET có giúp ích cho doanh nghiệp của bạn hay không? [ DONATE ] |
Alldatasheet là | Quảng cáo | Liên lạc với chúng tôi | Chính sách bảo mật | Liên kết đến bảng dữ liệu | Trao đổi link | Tìm kiếm theo nhà sản xuất 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 |