Frequency calculation of PWM wave generated by the output compare mode of the timer

Publisher:TranquilGazeLatest update time:2019-04-22 Source: eefocusKeywords:Timer Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The frequency calculation formula of the PWM wave generated by the output comparison mode of the timer is: 72M/((2*(arr+1))*(psc+1) )


For example, if you set: PWM_Init(1000-1,72-1); (PWM_Init(arr,psc);) then the frequency of each PWM channel is 500Hz. 

PWM_Init(arr,psc) 

TIM_TimeBaseStructure.TIM_Period = arr; TIM_TimeBaseStructure.TIM_Prescaler =psc; 

}



Keywords:Timer Reference address:Frequency calculation of PWM wave generated by the output compare mode of the timer

Previous article:UART SPI I²C comparison summary
Next article:Solution to st-link usb communication error when downloading STlink

Recommended ReadingLatest update time:2024-11-16 11:26

STM32 uses DMA+DAC+TIMER to output sine wave
I have briefly discussed this before. Based on my personal understanding and knowledge as a rookie, I will review the previous knowledge: DMA: My understanding is a channel, or a bridge. A communication channel between static memory and static memory, or between peripherals and static memory. The advantage of establis
[Microcontroller]
stm32f103 timer1 generates 400Hz PWM
/*Timer1 clock is 72MHz, generating 400Hz PWM with a duty cycle of 60%*/ void Bsp_Motor_PWM_Init(void) {     TIM_TimeBaseInitTypeDef TIM_TimeBaseInitStruct;     TIM_OCInitTypeDef       TIM_OCInitStruct;     GPIO_InitTypeDef GPIO_InitStruct;       RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1 | RCC_APB2Periph_GPIOA, ENABL
[Microcontroller]
C51 Timer Counter
Timer0 Counter: #include reg52.h //Include the header file. Generally, no modification is required. The header file contains the definition of special function registers. sbit LED=P1^2; //define LED port /*------------------------------------------------                     Timer initialization subroutine --------
[Microcontroller]
stm32_timer basic timer configuration and light flashing
There are a total of 11 timers in STM32, including 2 advanced control timers, 4 ordinary timers and 2 basic timers, as well as 2 watchdog timers and 1 system tick timer. TIM1 and TIM8 are advanced timers that can generate three pairs of PWM complementary outputs, and are commonly used to drive three-phase motors. The
[Microcontroller]
stm32_timer basic timer configuration and light flashing
PIC16F1829 TIMER0 initialization routine
Introduction: This article shares with you a PIC16F1829 TIMER0 initialization program. Interested friends can take a look. //timer0 division value #define TIMER0_DIV2 (0 0) #define TIMER0_DIV4 (1 0) #define TIMER0_DIV8 (2 0) #define TIMER0_DIV16 (3 0) #define TIMER0_DIV32 (4 0) #define TIMER0_DIV64 (5 0) #
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号