您的位置:首页 > 其它

OVERVIEW OF PULSE WIDTH MODULATION TIMER (PWM定时器介绍)

2017-03-28 10:58 441 查看
1.1 OVERVIEW OF PULSE WIDTH MODULATION TIMER(PWM定时器介绍)
The S5PV210 has five 32-bit Pulse Width Modulation (PWM) timers. These timers generate internal interrupts for the ARM subsystem. In addition, Timers 0, 1, 2 and 3 include a PWM function, which 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 is internal timers without output pins.
S5PV210有5个32位PWM定时器。这些定时器在ARM子系统中产生一个内部中断。另外,定时器0、1、2、3包含一个PWM功能,来驱动一个外部I/O信号。PWM定时器0有一个支持死区发生器能力,支持大电流设备,定时器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). Alternatively, the timers can select a clock source from CMU. Timers 0, 1, 2, 3, and 4 select SCLK_PWM.
这些定时器使用APB-PCLK作为原始种。定时器0和1 共享一个可编程8位预分频器,为PCLK提供第一级分频。定时器2、3、4共享一个不同的8位预分频器。每个定时器都有它自己独有的时钟分频器,提供一个二级时钟分频(预分频器除以2、4、8、16)。另外,这些定时器能从CMU中选择时钟源。定时器0、1、2、3、4选择SCLK_PWM。

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). If the down-counter reaches zero, counter reaches zero, the timer interrupt request is generated to inform the CPU that the timer operation is complete. If the timer down-counter reaches zero, the value of corresponding TCNTBn automatically reloads into the down-counter to start a next cycle. However, if 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寄存器的值。在定时器控制逻辑下,如果减计数寄存器的值与比较寄存器的值相匹配,定时器控制逻辑改变输出电平,因此,比较寄存器决定了PWN输出的开启时间(关闭时间)。



Steps in PWM cycle:
• Initialize the TCNTBn register with 159(50+109) and TCMPBn with 109.
• Start Timer: Set the start bit and manually update this bit to off.

The TCNTBn value of 159 is loaded into the down-counter, and then the output TOUTn is set to low.
• If down-counter counts down the value from TCNTBn to value in the TCMPBn register 109, the output

changes from low to high
• If the down-counter reaches 0, it generates an interrupt request.
• The down-counter automatically reloads TCNTBn. This restarts the cycle

PWM循环步骤:
• 初始化TCNTBn寄存器为159(50+109),TCMPBn为109.

• 开始计时:设置起始位并手动关闭该位.TCNTBn的值159加载到减计数寄存器,然后设置为低,输出TOUTn.

如果减计数器计数向下计数的值从TCNTBn到TCMPBn寄存器值为109,输出变化从低到高.


如果减计数器达到0,它产生一个中断请求.


减计数器自动重加载TCNTBn.重新开始循环.

1.2 KEY FEATURES OF PULSE WIDTH MODULATION TIMER
The Features supported by the PWM include:
• Five 32-bit Timers.
• Two 8-bit Clock Prescalers providing first level of division for the PCLK, and five Clock Dividers and

Multiplexers providing second level of division for the Prescaler clock and SCLK_PWM
• Programmable Clock Select Logic for individual PWM Channels.
• Four Independent PWM Channels with Programmable Duty Control and Polarity.
• Static Configuration: PWM is stopped
• Dynamic Configuration: PWM is running.
• Auto-Reload and One-Shot Pulse Mode.
• One external input to start the PWM.
• Dead Zone Generator on two PWM Outputs.
• Level Interrupt Generation.

1.2 PWM关键特性

PWM支持功能包括:
• 5个32位定时器;
• 2个8位预分频器为PCLK提供一级分频,5个时钟分频器和通道选择器为SYS_PWM提供二级分频;
• 单独的PWM通道可编程时钟选择逻辑;
• 4个独立PWM通道与可编程控制和极性;
• 静态配置:PWM是停止的;
• 动态配置:PWM是运行的;
• 重加载和单稳态脉冲模式;
• 外部输入启动PWM;
• 死区发生器在2次PWM输出之上;
• 标准中断产生;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: