Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PWM using PIC with out CCP module ???

Status
Not open for further replies.

sahu

Advanced Member level 2
Joined
Oct 9, 2009
Messages
516
Helped
68
Reputation
130
Reaction score
62
Trophy points
1,308
Location
Uttar pradesh (INDIA)
Activity points
3,876
how can use PWM using PIC with out CCP module ???
my aim controlling brightness of power led.
 

When you use CCP, you're using the hardware PWM. So, for PWM without CCP module, use software PWM. One way would be to use a timer. Have the timer interrupt at the end of each period. Depending on the time required, keep output on and off as required.

Check this out:

AN1074 - Software PWM Generation for LED Dimming and RGB Color Applications
**broken link removed**

Hope this helps.
Tahmid.
 

Dear Sahu

You have use timer to get the pulse. Something like this one

Here is sample

int i;
int percent;

percent = 52; // % time on
while(1) // loop forever
{
for (i=0; i>100; i++)
{
if (i < percent)
{
ra0 = 1; // turn bit on
}
else
{
ra0 = 0; // turn bit off
}
delay_ms(1); //some sort of delay here, determines freq
}

This will definately help you.
:) ))
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top