当前位置:网站首页>Tim output comparison - PWM
Tim output comparison - PWM
2022-07-27 02:17:00 【Ruomu·】
Catalog
One 、 What is output comparison
1. PWM Related parameters of :
2.PWM Application scenarios of :
3、 ... and . Several modes of output comparison :
Four , Polarity of output comparison
5、 ... and , In the output comparison ,TIM Common functions
6、 ... and , Different channel outputs of the same timer PWM Characteristics :
Preface
Briefly introduce the output comparison , This part is mainly the code part , The next one is passed PWM Breathing lights and PWM Control DC motor to introduce in detail TIM The output comparison function of
One 、 What is output comparison
Output comparison (Output Compare), By comparison CNT And CCR Relationship between register values , To set the output level 1, Set up 0 Or flip operation , Used to output a certain frequency and duty cycle PWM wave form , Every advanced timer and general timer have 4 Two output comparison channels
Be careful : The first three channels of the advanced timer have additional functions of dead band generation and complementary output
Two 、 What is? PWM
The expression of output comparison lies in PWM, and PWM If you've learned 51 I probably know ,PWM It's a pulse width modulation , It is embodied in the system with inertia , The required analog parameters can be obtained equivalently by modulating the width of some columns of pulses , It can be used to adjust the speed of the motor

1. PWM Related parameters of :
frequency :1/T;
Duty cycle :Ton/Ts
The resolution of the : Duty cycle change step
2.PWM Application scenarios of :
PWM The application scenario of must be an inertial system , With LED For example ,LED When it goes out , Due to the persistence of human vision ,LED It won't go out immediately , It has a certain inertia , It will take a short time to go out , For motors , Motor power failure , The rotation of the motor will not stop immediately , It has a certain inertia , It will stop after a while
According to the curve above ,PWM In fact, it can be regarded as the analog quantity represented by the dotted line in the middle
3. Duty cycle
The duty cycle determines PWM The equivalent analog voltage , The smaller the duty cycle , The equivalent analog voltage is closer to the low level , The larger the duty cycle , The equivalent analog voltage is closer to the high level
3、 ... and . Several modes of output comparison :
Timing Freeze mode
Active Set the effective level when equal
Inacktive Set invalid level when equal
Toggle When equal, the level turns
Four , Polarity of output comparison
TIM_OCPolarity_High : High polarity , That is, polarity does not flip ,REF Waveform output directly , Or effective level high level ,REF Is valid , Output high level
TIM_OCPolarity_Low: Low polarity , Namely REF The level is reversed , Or the effective level is low ,
5、 ... and , In the output comparison ,TIM Common functions
four OCinit function , It initializes the output comparison unit with a structure
TIM_CtrlPWMOutputs function , Only use advanced timer , When using advanced timer output PWM You need to call this function , Enable main output , otherwise PWM Will not output normally
middle 1088 To 1100 Some small functions of timer , Below are some functions that change parameters at runtime
among , four TIM_SetCompare Functions are important
TIM_OCStructInit function , Assign initial value to structure
TIM_SetCompare1 This function is used to change the channel separately 1 Of CCR It's worth it
6、 ... and , Different channel outputs of the same timer PWM Characteristics :
Because different channels share a counter , So their frequencies must be equal ;
Their duty cycle , By their own CCR decision , So the duty cycle can be set separately ;
Their aspect , Due to counter update , all PWM Simultaneous jump , So their phases are synchronized ;
for example , If you drive multiple steering gears or DC motors , Use a timer for different channels PWM, That's all right.
边栏推荐
- 7.13 Weilai approved the written examination in advance
- [详解C语言]一文带你玩转函数
- Golang - sync包的使用 (WaitGroup, Once, Mutex, RWMutex, Cond, Pool, Map)
- Autojs learning - realize image cutting
- 微信小程序:用户微信登录流程(附:流程图+源码)
- 静态路由缺省路由vlan实验
- Is index reproduction text generation image is score quantitative experiment whole process reproduction inception score quantitative evaluation experiment step on the pit and avoid the pit process
- Experiment exercise of two-layer packaging technology (HDLC, ppp--pap\chap, GRE)
- 最新C语言入门与进阶 -史上最全最详细的C语言教程!! 第一节-总览C语言概括
- JS logical operator
猜你喜欢
![[详解C语言]一文带你玩转选择(分支)结构](/img/ca/7ee9f62a2478785c97684c7a0cc749.png)
[详解C语言]一文带你玩转选择(分支)结构

JS 99 multiplication table

C语言——二维数组、指针

OSPF configuration in mGRE environment and LSA optimization - reduce the amount of LSA updates (summary, special areas)
![[explain C language in detail] takes you to play with functions](/img/44/53cdac9b9cf0d3f77e5da05956c3dc.png)
[explain C language in detail] takes you to play with functions

Solution: various error reports and pit stepping and pit avoidance records encountered in the alchemist cultivation plan pytoch+deeplearning (II)

(CF1691D) Max GEQ Sum

Experiment exercise of two-layer packaging technology (HDLC, ppp--pap\chap, GRE)

Static comprehensive experiment (comprehensive exercise of static route, loopback interface, default route, empty interface, floating static)

静态路由缺省路由vlan实验
随机推荐
C语言——赋值运算符、复合的赋值运算符、自增自减运算符、逗号运算符、条件运算符、goto语句、注释
C语言——第一个程序、打印、变量和常量
Codeforces Round #796 (Div. 2), problem: (1688C) Manipulating History
[explain C language in detail] takes you to play with functions
STM32入门教程第二讲
HCIA Basics (1)
6.28大华笔试
【数据库课程设计】SQLServer数据库课程设计(学生宿舍管理),课设报告+源码+数据库关系图
Unity Huatuo revolutionary hot update series [1]
关于在VS2022或者高级版本运行环境下遇到fopen,strerror等不安全的问题
OSPF在MGRE环境下配置及LSA的优化---减少LSA更新量(汇总、特殊区域)
Unity Huatuo example project source code analysis and inspiration
定时器中断实验
ensp中的简单静态路由
C language implementation of the small game [sanziqi] Notes detailed logic clear, come and have a look!!
第五讲—按键控制LED
HCIA静态路由综合实验
HCIA Basics (1)
最新C语言入门与进阶 -史上最全最详细的C语言教程!! 第一节-总览C语言概括
2022最新抖音直播监控(二)直播间流媒体下载