STM32F429 timer

Publisher:巳午未Latest update time:2018-12-26 Source: eefocusKeywords:STM32F429 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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

Keywords:STM32F429 Reference address:STM32F429 timer

Previous article:STM32 clock files
Next article:STM32F4XX interrupt number definition

Recommended ReadingLatest update time:2024-11-15 10:34

STM32F429 GPIO usage
STM32 IO mode (1) Floating input_IN_FLOATING——Floating input, can be used for KEY recognition, RX1 (2) With pull-up input_IPU——IO internal pull-up resistor input (3) With pull-down input_IPD——IO internal pull-down resistor input  (4) Analog input_AIN - Use ADC analog input or save power in low power mode (5) Open-drai
[Microcontroller]
STM32 TImer several modes_general timer
Input capture mode Library function routine location: STM32F10x_StdPeriph_Lib_V3.3.0\Project\STM32F10x_StdPeriph_Examples\TIM\InputCapture In input capture mode, when the corresponding edge on the ICx signal is detected, the current value of the counter is latched into the capture/compare register (TIMx_CCRx). When
[Microcontroller]
STM32 TImer several modes_general timer
STC MCU timer2 capture mode frequency measurement
The most common method of measuring frequency using an STC microcontroller is to count the number of pulses within a certain period of time. This method generally requires a counter and a timer to work together, and it is not very accurate for low-frequency signals. Next, we can use the capture mode of timer2 to calcu
[Microcontroller]
STC MCU timer2 capture mode frequency measurement
PIC Timer (TIMER0)
    For example, if the internal instruction cycle clock is set as the clock source and the frequency division is 1:4 for a 4M crystal oscillator, the timer increment is 1us (but the PIC18F microcontroller is Three-stage pipeline, one instruction cycle = 1/4 clock/crystal cycle. For example: 8M crystal
[Microcontroller]
PIC Timer (TIMER0)
MSP430 basic timer basic timer interrupt time calculation
I recently worked with 430 and was troubled by the BT timer. The BT timer is different from the ordinary timer of AVR that I have used before. The previous timer counted to FF and then generated an overflow interrupt. But the BT timer is different. The BT timer generates an interrupt when the corresponding selectio
[Microcontroller]
MSP430 basic timer basic timer interrupt time calculation
SDRAM usage based on STM32F429
Use ST's HAL library for development, and the SDRAM used is W9825G6KH-6. W9825G6KH-6 has 4 banks, 13-bit row address, 9-bit column address, and 16-bit bit width. So the capacity of the chip is: 4x8192x512x16=256Mbits=32MBytes. The schematic diagram of W9825G6KH-6 is as follows: FMC_D0~15: 16-bit data line; FMC_A0~
[Microcontroller]
MSP430 MCU 16-bit timer Timer_A operation
/**********(一)Timer A comparison mode*************/  int main( void )  {  WDTCTL=WDTPW+WDTHOLD; //Turn off watchdog  BCSCTL1 =CALBC1_1M Hz ; //Set DCO to 1MHZ  DCOCTL =CALBC1_1MHZ;    P1DIR |= BIT0; //LED enable  TACTL=TASSEL1+TACLR; //Timer A clock source is SMCLK, and clear TAR  CCTL0 |= CCIE; //CCR0 interrupt enabl
[Microcontroller]
Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号