PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Feb 07, 2007 5:31 pm |
|
|
Read this note from the 16F876A data sheet, in the PWM section:
Quote: |
Note:
The Timer2 postscaler (see Section 7.1) is
not used in the determination of the PWM
frequency. The postscaler could be used
to have a servo update rate at a different
frequency than the PWM output.
|
In other words, if you want to periodically change the PWM duty cycle,
you could do it inside a Timer2 interrupt routine. This would allow the
duty cycle to be changed after an integral number of PWM cycles.
The Timer2 postscaler allows you to control the rate at which Timer2
interrupts occur. Instead of occuring once every PWM cycle, you
could set the interrupt to occur once every 8 cycles (for example).
The reason for doing this is described in the Microchip patent on the
PWM module:
Quote: |
According to the present invention, a scheme is provided by which
interrupts are generated in connection with the PWM function of the
microcontroller only at relatively long intervals, while still permitting
the PWM to be run at considerably higher frequencies. This is achieved
by use of a postscaler circuit in conjunction with a PWM timing module.
The postscaler functions to reduce the interrupt overhead by reducing
the frequency of interruption of the CPU, without affecting the
setting of the period of the waveform.
|
This text is from the patent at the following link. Scroll down about 2/3 of
the way down the page, to the section on "Summary of the Invention":
http://www.freepatentsonline.com/5594894.html |
|