View previous topic :: View next topic |
Author |
Message |
masiha308
Joined: 07 Apr 2010 Posts: 3 Location: IRAN
|
PWM |
Posted: Thu Apr 08, 2010 3:59 am |
|
|
Hi there
I want to set a pwm module in PIC16F877A but i dont know how to set this.
Can you help me?
I you can tell me step-by-step to design a pwm pulse for a variable duty cycle and variable priod.
thank you |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19367
|
|
Posted: Thu Apr 08, 2010 4:38 am |
|
|
ex_pwm.c with the compiler.
Varying the actual frequency, is very rare in PWM applications. Problem is that as you change the frequency, the 'legal' values for duty change with them. Normally a PWM application, would run fixed frequency, and just vary the duty cycle, or if you wamted a variable frequency 'source', then you would run at either a fixed pulse width, or at just 50% duty cycle. Varying both in the same code would get complex....
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Apr 08, 2010 10:49 am |
|
|
There are a large number of PWM sample programs in the forum
archives. You can use the forum's Search engine to find them.
Take a pwm function from the CCS manual. Put the name of the
function and your PIC type into the search engine. Example:
Quote: | set_pwm1_duty 16F877* |
Then set it to: Search for all Terms.
You will get many hits. Here is one example:
http://www.ccsinfo.com/forum/viewtopic.php?t=17729&start=1 |
|
![](templates/subSilver/images/spacer.gif) |
|