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

c-code for pwm that ramps up with time(soft starter)

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



Joined: 30 Aug 2007
Posts: 144
Location: South Africa

View user's profile Send private message Send e-mail

c-code for pwm that ramps up with time(soft starter)
PostPosted: Sun Sep 02, 2007 5:12 pm     Reply with quote

Hi
I am looking for some sample program to start a dc motor on a single output that will start the motor very slowly and then speed it up until full speed. Any ramp time is fine.
Guest








PostPosted: Mon Sep 03, 2007 12:47 pm     Reply with quote

Interesting question, anybody has a idee?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Sep 03, 2007 1:08 pm     Reply with quote

The reason no one answered (I think) is because it's so simple.

1. Setup for PWM. Use a variable to hold the duty cycle, and initially
set it to 0. Call the set_pwm1_duty() function with this variable
as the parameter, to set the duty to 0 at the start.

2. Create a for() loop. Setup the count in the for() loop so it has
the number of steps that you want it to take, before it gets up to
full speed.

3. Inside the for loop, put a set_pwm1_duty() statement, with the
duty cycle variable as the parameter. Then put a delay_ms()
statement after that, with the amount of time that you want it
to wait for each step of the "ramp up" period.

4. Put a continuous loop at the end of the program with a while(1);
statement (with nothing in it).

Then run it.
Gerhard



Joined: 30 Aug 2007
Posts: 144
Location: South Africa

View user's profile Send private message Send e-mail

PostPosted: Mon Sep 03, 2007 1:16 pm     Reply with quote

THANKS PCM

I KNOW SOMETIMES EASY THINGS LIKE THAT MIGHT FRUSTRATE YOU PRO'S BUT THIS IS A NEW FIELD FOR ME SO EVEN KNOWING ABOUT THE PWM FUNCTION WOULD HAVE BEEN A BONUS FOR ME.

THANKA
icesynth



Joined: 03 Sep 2007
Posts: 32
Location: Edmonton, Alberta

View user's profile Send private message Visit poster's website

PostPosted: Mon Sep 03, 2007 5:01 pm     Reply with quote

Give us a couple days to answer, waiting one day is a fairly short time in a forum. BTW, I think you forgot caps lock on Wink

How high of a current are you running into the DC motor? I agree that using the built in PWM functions are good, but have you thought about current feedback as well?

I am using a CSLA2CD ( Digikey 480-1994-ND ) hall effect current sensor for one of my DC compressor motor drivers. The motor runs at about 10A, 48VDC, and I have the main supply wire for the motor looped twice through the ferrite of the current sensor for better resolution, and the output of the sensor going into the PIC ADC Input.

On initial startup, the PWM is set to off, and for my application, I let the duty cycle increase until an average current of about 14A is reached, and as the motor speeds up, the current will go down, so the duty cycle increases until the current is below the 14A set point, where the duty cycle increases until it is at maximum ( always on ) and the compressor runs normally.

This is mainly used because the power source can't handle a huge rush of current. It also works because the compressor never starts under load.

But for PWM information, look at /examples/EX_PWM.C in your CCS directory for examples of using PWM.

Just ideas...
--Chris Burchett--
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