The difference between STM32 timer output comparison mode and PWM output mode

Publisher:花钱123Latest update time:2018-12-10 Source: eefocusKeywords:STM32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

I spent several days trying to get a timer to output a square wave. It worked fine at first, but then it stopped working. I was so frustrated... 


After a long period of oscilloscope observation and exploration, I found that the functions of the registers in the ordinary comparison output mode and the PWM mode are different.


Comparison output mode


The characteristic of this mode is that the output cycle frequency of the four channels is the same. The frequency period is determined by the size of the preload register ARR. It is called Counter Period in Cubmx. The larger the value, the lower the output frequency.


But this mode has a feature that the initial phase of each channel can be determined by the CCRx of each channel. 


Write the picture description here


PWM Mode


The frequency length of the waveform cycle is determined by ARR 


The duration of the high level is determined by the CCRx of each channel.


Write the picture description here


The difference between the two modes is that the role of CCRx is different in different modes. 


In output comparison mode, CCRx controls the initial phase. 


In PWM mode, CCRx controls the high level counting cycle.


Keywords:STM32 Reference address:The difference between STM32 timer output comparison mode and PWM output mode

Previous article:STM32 serial port idle interrupt receives indefinite length data
Next article:The relationship between the frequency of the STM32 timer output square wave and PSC and CNT

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号