Question one:
//TIM2 pre-scaling setting: 1MHZ, APB1 division factor 2, input to TIM3 clock is 36MHzx2 = 72MHz
TIM_PrescalerConfig(TIM2,71, TIM_PSCReloadMode_Immediate);
void TIM_PrescalerConfig(TIM_TypeDef* TIMx, uint16_t Prescaler, uint16_t TIM_PSCReloadMode)
{
/* Check the parameters */
assert_param(IS_TIM_ALL_PERIPH(TIMx));
assert_param(IS_TIM_PRESCALER_RELOAD(TIM_PSCReloadMode));
/* Set the Prescaler value */
TIMx->PSC = Prescaler;
/* Set or reset the UG Bit */
TIMx->EGR = TIM_PSCReloadMode;
}
When set to change immediately, that is, UG is set to 1, an update event is generated immediately and the frequency division coefficient changes.
The previous statement is equivalent to
TIM_TimeBaseStructure.TIM_Prescaler = 71;
At this time, the counting frequency of CNT is 1MHZ
Question 2:
TIM_TimeBaseStructure.TIM_Period = 1000; //1KHz
The above statement sets the auto-reload value to 999, which is the ARR value.
After this statement, the frequency of pwm is 1kHz
How to calculate it? It is very simple, 1M/1000 = 1kHz
One cycle of PWM is when the counter counts from 0 to ARR, that is, it takes 1000 times to complete one cycle.
Question 3:
uint16_t TIM_Pulse; /*!< Specifies the pulse value to be loaded into the Capture Compare Register.
This parameter can be a number between 0x0000 and 0xFFFF */
Equivalent to
void TIM_SetCompare2(TIM_TypeDef* TIMx, uint16_t Compare2)
Both set the value of the CCR register
Previous article:STM32F407ZET6 Detailed explanation on using PWM (making breathing light)
Next article:STM32F407 advanced timer dead zone complementary PWM (operation register)
Recommended ReadingLatest update time:2024-11-25 13:22
- Popular Resources
- Popular amplifiers
- STM32 Reference History
- 西门子S7-12001500 PLC SCL语言编程从入门到精通 (北岛李工)
- Small AC Servo Motor Control Circuit Design (by Masaru Ishijima; translated by Xue Liang and Zhu Jianjun, by Masaru Ishijima, Xue Liang, and Zhu Jianjun)
- Intelligent Control Technology of Permanent Magnet Synchronous Motor (Written by Wang Jun)
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- Automechanika Shanghai 2024 to feature a record number of concurrent events, bringing together industry wisdom and planning for future development
- Corporate Culture Sharing: How to cultivate scarce silicon IP professionals? SmartDV's journey of personal growth and teamwork
- Corporate Culture Sharing: How to cultivate scarce silicon IP professionals? SmartDV's journey of personal growth and teamwork
- NXP releases first ultra-wideband wireless battery management system solution
- NXP releases first ultra-wideband wireless battery management system solution
- Beijing Jiaotong University undergraduates explore Tektronix's advanced semiconductor open laboratory and experience the charm of cutting-edge high technology
- Beijing Jiaotong University undergraduates explore Tektronix's advanced semiconductor open laboratory and experience the charm of cutting-edge high technology
- New CEO: Dr. Torsten Derr will take over as CEO of SCHOTT AG on January 1, 2025
- How Edge AI Can Improve Everyday Experiences
- How Edge AI Can Improve Everyday Experiences
- Questions about PCB output data
- The concepts of FPGA and ASIC, their differences
- How to add own image processing operations to the zynq video pipeline?
- The program stops at the disassembled code
- DC-DC Applications
- Please tell me the DSP code and FW
- Why use 4-20mA current to transmit analog quantity?
- LED rotating fan solution for sale
- Power Technology Popular Data Download Collection
- Start learning electronics in spring in TI classroom, and watch the special post for the grab-the-floor activity for solid basic courses!