文件名称:PWM
介绍说明--下载内容均来自于网络,请自行研究使用
Atmega 16单片机,这里利用T/C1定时器中断来产生PWM波形。在ICC AVR编译环境下,利用tool 菜单中的application builder生成一个简单的PWM波程序。这段程序以PA0作为PWM波的输出端口。利用T/C1定时器比较匹配和溢出产生两次中断来改变PA0的输出电平。具体过程为:计数器TCNT1从初始值开始不断计数,当发生比较匹配时,把PA0置为低电平,计数器继续计数,当发生溢出中断时,计数器回到初始设定值,并把PA0置为高电平。从而在PA0端口获得一稳定持续的PWM波形,在主程序中改变比较值,即可改变波形占空比,而频率不变。-Atmega 16 microcontroller, T/C1 timer interrupt to generate a PWM waveform. ICC AVR compiler environment, the application builder tool menu to generate a simple PWM wave program. This program PA0 as PWM wave output ports. The use of T/C1 timer compare match and overflow twice interrupted PA0 to change the output level. Process: the counter TCNT1 from the initial value began to count, compare match occurs, the PA0 set low, the counter continues to count when an overflow interrupt occurs, the counter back to the initial setting, and PA0 is set to the high level. PA0 port access to a stable and sustainable PWM waveform, change the comparison value in the main program, you can change the waveform duty cycle, and the frequency is the same.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
PWM