| Electronic Components Datasheet Search |
|
AN4062 Datasheet(PDF) 14 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN4062 Datasheet(HTML) 14 Page - STMicroelectronics |
|
14 / 17 page ![]() Peripheral firmware examples description AN4062 14/17 DocID022897 Rev 3 The objective is to generate a PWM signal at 17.57 KHz: – TIM1_Period = (SystemCoreClock / 17570) - 1 – TIM1 Frequency = TIM1 counter clock/(ARR + 1) = 48 MHz / 2730 = 17.57 kHz • The TIM1 CCR1 register value is equal to 1364, so the TIM1 Channel 1 generates a PWM signal with a frequency equal to 17.57 kHz and a duty cycle equal to 50%: TIM1 Channel1 duty cycle = (TIM1_CCR1/ TIM1_ARR + 1)* 100 = 50% • The TIM1 CCR2 register value is equal to 1023, so the TIM1 Channel 2 generates a PWM signal with a frequency equal to 17.57 kHz and a duty cycle equal to 37.5%: TIM1 Channel2 duty cycle = (TIM1_CCR2/ TIM1_ARR + 1)* 100 = 37.5% • The TIM1 CCR3 register value is equal to 682, so the TIM1 Channel 3 generates a PWM signal with a frequency equal to 17.57 kHz and a duty cycle equal to 25%: TIM1 Channel3 duty cycle = (TIM1_CCR3/ TIM1_ARR + 1)* 100 = 25% • The TIM1 CCR4 register value is equal to 431, so the TIM1 Channel 4 generates a PWM signal with a frequency equal to 17.57 kHz and a duty cycle equal to 12.5%: TIM1 Channel4 duty cycle = (TIM1_CCR4/ TIM1_ARR + 1)* 100 = 12.5% Note: The PWM waveform can be displayed using an oscilloscope. Connect the TIM1 pins to an oscilloscope to monitor the different waveforms: • TIM1_CH1 pin (PA.08) • TIM1_CH2 pin (PA.09) • TIM1_CH3 pin (PA.10) • TIM1_CH4 pin (PA.11) 3.18 Timer ADC trigger example Purpose This example describes how to configure the TIM to trigger the ADC conversion. Description In this example, the TIM1 is configured in PWM mode, the TIM1 CC4 event is used to trigger the ADC. The ADC is configured to convert continuously the ADC_Channel_11 (connected to an external voltage). Each time the TIM1 CC4 event occurs, the ADC converts the variable voltage. Note: Connect the external signal ranges between 0 and 3.3V to ADC pin (PC.01). 3.19 NVIC WFI mode example Purpose This example shows how to enter the WFI mode and wake up from this mode by the User key interrupt. |
|
|
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 |
| 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 |