| Electronic Components Datasheet Search |
|
AN4062 Datasheet(PDF) 12 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN4062 Datasheet(HTML) 12 Page - STMicroelectronics |
|
12 / 17 page ![]() Peripheral firmware examples description AN4062 12/17 DocID022897 Rev 3 The Three Duty cycles are computed as follows: – The channel 1 duty cycle is set to 50% so channel 1N is set to 50%. – The channel 2 duty cycle is set to 25% so channel 2N is set to 75%. – The channel 3 duty cycle is set to 12.5% so channel 3N is set to 87.5%. The Timer pulse is calculated as follows: • ChannelxPulse = DutyCycle * (TIM1_Period - 1) / 100 A dead time equal to 11/SystemCoreClock is inserted between the different complementary signals, and the Lock level 1 is selected.The break Polarity is used at High level. The TIM1 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_CH1N pin (PB.13) – TIM1_CH2 pin (PA.9) – TIM1_CH2N pin (PB.14) – TIM1_CH3 pin (PA.10) – TIM1_CH3N pin (PB.15) • Connect the TIM1 break pin TIM1_BKIN pin (PB.12) to the GND. To generate a break event, switch this pin level from 0V to 3.3V. 3.15 TIM time base example Purpose This example shows how to configure the TIM peripheral in Output Compare Timing mode with the corresponding Interrupt requests for each channel, in order to generate 2 different time bases. Description The TIM3CLK frequency is set to SystemCoreClock (Hz), to get TIM3 counter clock at 6 MHz so the Prescaler is computed as follows: • Prescaler = (TIM3CLK / TIM3 counter clock) - 1. • SystemCoreClock is set to 48 MHz. • The TIM3 CC3 register is equal to 13654, CC3 update rate = TIM3 counter clock / CCR3_Val = 439.4 Hz. Thus, the TIM3 Channel 3 generates an interrupt every 2.27 ms. • The TIM3 CC4 register is equal to 6826, CC4 update rate = TIM3 counter clock / CCR4_Val = 878.9 Hz. Thus, the TIM3 Channel 4 generates an interrupt every 1.13 ms. When the counter value reaches the Output compare registers values, the Output Compare interrupts are generated and, in the handler routine, 2 LEDs (LED3 and LED4) connected to PC08 and PC09 are toggled with the following frequencies: – LED3(PC09): 219.7 Hz (CC3) – LED4(PC08): 439.4 Hz (CC4) |
|
|
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 |