F429 has 14 timers in total
2 advanced TIM1, TIM8
10 general purpose TIM2~TIM5 TIM9~TIM14
2 basic TM6, TIM7 only TIM_Prescaler and TIM_Period
1. Configuration priority
NVIC_InitTypeDef NVIC_InitStructure;
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0); The interrupt group is 0
NVIC_InitStructure.NVIC_IRQChannel = TIM6_DAC_IRQn; Interrupt source
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; Preemption priority
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3; Subpriority
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
2.TIM initialization
TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM6, ENABLE); Initialize the clock
TIM_TimeBaseStructure.TIM_Period = 5000-1; Automatic reload value (ie timing time)
TIM_TimeBaseStructure.TIM_Prescaler = 9000-1; Frequency division coefficient
The following are only available in general and advanced timers
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; Counting mode: count up
TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1; Division factor
TIM_TimeBaseStructure.TIM_RepetitionCounter=1;Repetition count
TIM_TimeBaseInit(TIM6, &TIM_TimeBaseStructure); Initialize the timer
TIM_ClearFlag(TIM6, TIM_FLAG_Update); Clear the timer interrupt flag
TIM_ITConfig(TIM6,TIM_IT_Update,ENABLE); Enable timer update interrupt
TIM_Cmd(BASIC_TIM, ENABLE); Enable timer
3. Write interrupt service function
void TIM6_DAC_IRQHandler (void)
{
if ( TIM_GetITStatus( TIM6, TIM_IT_Update) != RESET )
{
LED1_TOGGLE;
TIM_ClearITPendingBit(TIM6 , TIM_IT_Update);
}
}
The service function name is in stsrtup_stm32f429_439xx.s
Previous article:STM32 clock files
Next article:STM32F4XX interrupt number definition
Recommended ReadingLatest update time:2024-11-15 10:34
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Detailed explanation of intelligent car body perception system
- How to solve the problem that the servo drive is not enabled
- Why does the servo drive not power on?
- What point should I connect to when the servo is turned on?
- How to turn on the internal enable of Panasonic servo drive?
- What is the rigidity setting of Panasonic servo drive?
- How to change the inertia ratio of Panasonic servo drive
- What is the inertia ratio of the servo motor?
- Is it better for the motor to have a large or small moment of inertia?
- What is the difference between low inertia and high inertia of servo motors?
- 【Zero Knowledge ESP8266】Tutorial: Mobile APP Control RGB LED
- The application of CAN bus data in automobile digital technology is the starting point
- TI AM335 Embedded Hardware Design Reference Guide OK335xD
- Infineon Position2Go Development Kit Review @2. Official Tools
- Application of ISP chips in edge computing
- [Atria AT32WB415 Review] 2. Firmware burning (taking AT-Link burning as an example)
- MOS tube anti-reverse connection
- Why do DSPs with large on-chip RAM have high efficiency?
- Altera SoC Architecture Excerpt - What is a SoC FPGA.pdf
- Zero Knowledge Open Source Sharing - Use of Temperature and Humidity Module DHT11