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 CCS Technical Support

Power PWM module 18f2331

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



Joined: 07 Sep 2012
Posts: 4

View user's profile Send private message

Power PWM module 18f2331
PostPosted: Fri Sep 07, 2012 7:48 am     Reply with quote

Hi, I'm using the 18f2331 microcontroller from microchip and I want to use the Power Pwm module.

I need to control each PWM (PWM0,PWM1,PWM2,PWM3) independently to drive this :

How can I drive a pair to drive the bridge ??


Thanks for your help !
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Fri Sep 07, 2012 9:36 am     Reply with quote

i dont think anyone is going to give you the code for exactly what you want or code it for your.... you can try your luck searching on the code library.

try coding it yourself, and should you have any problems, then the forum users will gladly help you.

G.
_________________
CCS PCM 5.078 & CCS PCH 5.093
madcreator



Joined: 07 Sep 2012
Posts: 4

View user's profile Send private message

PostPosted: Fri Sep 07, 2012 11:25 am     Reply with quote

I don't want the exact code, I just want someone that understand how the power pwm module work ! So I can understand it !

I have already tried coding but nothing works that why I'm posting here!


Madz Very Happy
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Sep 07, 2012 12:02 pm     Reply with quote

Then post the code that you tried but didn't work.
jeremiah



Joined: 20 Jul 2010
Posts: 1358

View user's profile Send private message

PostPosted: Fri Sep 07, 2012 12:04 pm     Reply with quote

Generally the first step (and part of our forum guidelines), is to create a small, compilable program that only addresses your issue, and post it up here so we can take a stab at why the code you tried doesn't work. We're not looking for your entire program, just something that compiles and runs on it's own and that illustrates the problem.

Once you can get that up, we can try to help you out better.
madcreator



Joined: 07 Sep 2012
Posts: 4

View user's profile Send private message

PostPosted: Fri Sep 07, 2012 12:08 pm     Reply with quote

Code:
#define POWER_PWM_PERIOD 1999
      
void main()
{   
setup_power_pwm_pins(PWM_BOTH_ON, PWM_BOTH_ON, PWM_OFF, PWM_OFF);   
 
//Frequency = Fosc / (4 * (period+1) *postscale)
 
setup_power_pwm(PWM_FREE_RUN, 1, 0, POWER_PWM_PERIOD, 0, 1,0); 
 
 
   while(1)
   {
     SET_POWER_PWM0_DUTY(100);
     set_power_pwm_override(1,1,0);
     SET_POWER_PWM2_DUTY(30);
     set_power_pwm_override(2,1,0);
   }      
}


This code is to make the motor turn in one direction.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Sep 07, 2012 1:39 pm     Reply with quote

Do you have to use an 18F2331 with a Power Control PWM module ?
Because your Tip#15 shows a PIC with an ECCP module. It's very
easy to configure Full Bridge mode with an ECCP with CCS. Example:
http://www.ccsinfo.com/forum/viewtopic.php?t=29565&start=1
madcreator



Joined: 07 Sep 2012
Posts: 4

View user's profile Send private message

PostPosted: Fri Sep 07, 2012 1:45 pm     Reply with quote

Cool example ! I've made the circuit like that,and this pic is quite little tht why I choosed this one, and I was thinking that the power pwm module was easy to use...

I think I will make a another circuit with a 18f4550 and use the ECCP !

Thanks a lot for your help.

Madz
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Sep 07, 2012 1:59 pm     Reply with quote

Here are some PICs with an ECCP module:

18F1220/1330

18F4221/4321

18F4220/4320

18F4410/4510/4515/4610

18F4480/18F4580

18F4420/4520

18F4525/4620

18F4550/4455

There's a lot more. I just stopped at that point.
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