In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you "how to solve the problem of STM32 ordinary timer configuration PWM", the content is easy to understand, clear, hope to help you solve your doubts, the following let Xiaobian lead you to study and learn "how to solve the STM32 ordinary timer configuration PWM problem" this article.
Oid TIM3_Init (void) {TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; TIM_OCInitTypeDef TIM_OCInitStructure; / * PWM signal level jump value * / / U16 CCR1= 36000; / / U16 CCR2= 36000; / * PCLK1 is equal to 72MHz*/ RCC_APB1PeriphClockCmd (RCC_APB1Periph_TIM3, ENABLE) as the clock source of TIM3 after 2-octave. / * Time base configuration * / TIM_TimeBaseStructure.TIM_Period = 1599; / / count period 1600 TIM_TimeBaseStructure.TIM_Prescaler = 1; / / set pre-division: pre-division = 2, that is, 72/3=24MHz TIM_TimeBaseStructure.TIM_ClockDivision = 0 / / set clock frequency division factor: no frequency division TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; / / upward count overflow mode TIM_TimeBaseInit (TIM3, & TIM_TimeBaseStructure); / * PWM1 Mode configuration: Channel1 * / TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1 / / configure to PWM mode 1 TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable; TIM_OCInitStructure.TIM_Pulse = 600; / / set the jump value, when the counter counts to this value, the level jumps TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_Low / / High level TIM_OC1Init (TIM3, & TIM_OCInitStructure) when the timer count is less than CCR1; / / enable channel 1 TIM_OC1PreloadConfig (TIM3, TIM_OCPreload_Enable); / * PWM1 Mode configuration: Channel2 * / TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable; TIM_OCInitStructure.TIM_Pulse = 300 / / set the level jump value of channel 2, and output another duty cycle PWM TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High; / / low level TIM_OC2Init (TIM3, & TIM_OCInitStructure) when the timer count is less than CCR2. / / enable channel 2 TIM_OC2PreloadConfig (TIM3, TIM_OCPreload_Enable); TIM_ARRPreloadConfig (TIM3, ENABLE); / / enable TIM3 overload register ARR / * TIM3 enable counter * / TIM_Cmd (TIM3, ENABLE); Delay_8ms (); TIM_Cmd (TIM3, DISABLE) } these are all the contents of this article entitled "how to solve the problem of configuring PWM in STM32 ordinary timers". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
The php memcached methods are: 1, set (); 1.
© 2024 shulou.com SLNews company. All rights reserved.