CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

setup_timer2 PWM postscale not working

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Feb 07, 2007 5:31 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group