PWM时钟树---》嵌入式简单说

PWM时钟树的详细注释

疫情在家期间复习到了这里,就来敲一些东西,一是帮助自己复习,防止以后遗忘,二来也是把自己的心得分享一下!我个人是比较喜欢在图上画一画,标一标,觉得这样有助于记忆。如果你觉得不错,可以关注一下松鼠哥的公众号----嵌入式简单说,我会陆续把ARM的一些外设学习心得写出来和大家分享。

以三星的s5p6818芯片为例,其他的ARM芯片也差不多。

下面是芯片手册对PWM这一章的概述,英语也不好的我一条条翻译啦,然后对这图片加了注释,建议你对照图片去理解下面的一段死长死长的英文文档,希望你耐心点看完。图片在下面…

The S5P6818 has five 32-bit Pulse Width Modulation (PWM) timers.These Timers generate internal interrupts for the ARM subsystem.Additionally, Timers 0, 1, 2 and 3 include a PWM function that drives an external I/O signal.The PWM in Timer 0 has an optional dead-zone generator capability to support a large current device.Timer 4 isinternal timer without output pins.
S5P6818有5个32位脉冲宽度调制(PWM)定时器。 这些计时器为ARM子系统生成内部中断。此外,定时器0、1、2和3还包括一个驱动外部I/O信号的PWM函数。定时器0中的PWM有一个可选的死区发生器功能来支持大电流设备。定时器4是没有输出插脚的内部定时器。
The Timers use the APB-PCLK as source clock. Timers 0 and 1 share a programmable 8-bit prescaler that provides the first level of division for the PCLK. Timers 2, 3, and 4 share a different 8-bit prescaler. Each timer has its own private clock-divider that provides a second level of clock division (prescaler divided by 2, 4, 8, or 16).
计时器使用APB-PCLK作为源时钟。定时器0和1共享一个可编程的8位预分频器,为PCLK提供了第一级的分频。定时器2、3和4共享另一个8位预分频器。每个定时器都有自己的专用时钟除法器(也就是二级分频),它提供第二级的时钟除法器(除法器除以2、4、8或16)。
Each Timer has its own 32-bit down-counter which is driven by the timer clock. The down-counter is initially loaded from the Timer Count Buffer register (TCNTBn). When the down-counter reaches zero, the timer interrupt request is generated to inform the CPU that the Timer operation is complete. When the Timer down-counter reaches zero, the value of corresponding TCNTBn automatically reloads into the down-counter to start the next cycle. However, when the Timer stops, for example, by clearing the timer enable bit of TCONn during the Timer running mode, the value of TCNTBn is not reloaded into the counter.
每个定时器都有自己的32位向下计数器,由定时器驱动。向下计数器最初是从计时器计数缓冲寄存器(TCNTBn)加载的。当向下计数器达到0时,将生成计时器中断请求,以通知CPU计时器操作已经完成。当向下计数器达到0时,相应的TCNTBn的值会自动重新加载到下一个计数器中,开始下一个循环。但是,当计时器停止时,例如,通过在计时器运行模式期间清除计时器启用位TCONn, TCNTBn的值不会重新加载到计数器中。
The PWM function uses the value of the TCMPBn register. The Timer Control Logic changes the output level if down-counter value matches the value of the compare register in Timer Control Logic. Therefore, the compare register determines the turn-on time or turn-off time of a PWM output.
PWM函数使用TCMPBn寄存器的值。如果向下计数器的值与计时器控制逻辑中的比较寄存器的值匹配,则计时器控制逻辑将更改输出级别。因此,比较寄存器决定了PWM输出的开关时间。
The TCNTBn and TCMPBn registers are double buffered so that it allows the Timer parameters to be updated in the middle of a cycle. The new values do not take effect until the current Timer cycle is completed.
TCNTBn和TCMPBn寄存器是双缓冲的,因此它允许在一个周期的中间更新计时器参数。新值直到当前计时器周期完成后才生效。
在这里插入图片描述
在这里插入图片描述
下面是针对S5P6818的一些寄存器介绍,可能其他的SOC的寄存器名字不一样,大同小异吧,你们可以借鉴一下!

1. 选择IO 引脚的复用功能
在这里插入图片描述
2. 设置一级分频值
在这里插入图片描述
3. 设置二级分频值
在这里插入图片描述
4. 设置控制寄存器TCON
在这里插入图片描述
5. 设置计数缓冲寄存器TCNTBn
在这里插入图片描述
6. 设置比较缓存寄存器TCMPBn
在这里插入图片描述
伪代码实例:
在这里插入图片描述

好啦,这些都是常用的功能,如果文中有错误请各位在评论区多多指正

喜欢的可以关注一下松鼠哥的公众号----嵌入式简单说我会陆续把ARM的一些外设学习心得写出来和大家分享
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值