Electronic Components Datasheet Search
  English  ▼
ALLDATASHEET.NET

X  

AN4157 Datasheet(PDF) 20 Page - STMicroelectronics

Part # AN4157
Description  STM32F3DISCOVERY peripheral firmware examples
PDF  24 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  STMICROELECTRONICS [STMicroelectronics]
Direct Link  http://www.st.com
Logo STMICROELECTRONICS - STMicroelectronics

AN4157 Datasheet(HTML) 20 Page - STMicroelectronics

Back Button AN4157 Datasheet HTML 16Page - STMicroelectronics AN4157 Datasheet HTML 17Page - STMicroelectronics AN4157 Datasheet HTML 18Page - STMicroelectronics AN4157 Datasheet HTML 19Page - STMicroelectronics AN4157 Datasheet HTML 20Page - STMicroelectronics AN4157 Datasheet HTML 21Page - STMicroelectronics AN4157 Datasheet HTML 22Page - STMicroelectronics AN4157 Datasheet HTML 23Page - STMicroelectronics AN4157 Datasheet HTML 24Page - STMicroelectronics  
Zoom Inzoom in Zoom Outzoom out
 20 / 24 page
background image
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.



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24


Datasheet Download

Go To PDF Page


Link URL



Does ALLDATASHEET help your business so far?  [ DONATE ] 

About Alldatasheet   |   Advertisement   |   Contact us   |   Privacy Policy   |   Link to Datasheet    |   Link Exchange   |   Manufacturer List
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
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