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

Stepper With PWM

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



Joined: 11 Apr 2014
Posts: 16

View user's profile Send private message

Stepper With PWM
PostPosted: Sun Dec 14, 2014 9:31 pm     Reply with quote

Hello all,
I am new to stepper, have driven it with a sequence of pulses controlled by delay function running motor in full step mode. Now i want to control motor with PWM as my controller needs to to do other tasks too like displaying RPM etc. PWM sends continuous signals but they can not be used for stepper as it require appropriate order of pulse on each phase. I have searched on internet and forums but couldn't find solution. Please suggest me how to control stepper without delay functions.
Waiting for some help, Thanks.
dyeatman



Joined: 06 Sep 2003
Posts: 1934
Location: Norman, OK

View user's profile Send private message

PostPosted: Sun Dec 14, 2014 9:58 pm     Reply with quote

I suggest that you try a search in the forum first.
There are a lot of examples...
_________________
Google and Forum Search are some of your best tools!!!!
tim_sid



Joined: 11 Apr 2014
Posts: 16

View user's profile Send private message

PostPosted: Mon Dec 15, 2014 1:04 am     Reply with quote

Yeah there are many examples but how can i generate 4 different PWM signals with appropriate delays causing specific pulses per second? Actually i am generating 4 pulses and apply them to 4 phases of motor via MOSFETs.
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Mon Dec 15, 2014 2:05 am     Reply with quote

You don't.

Stepper motors don't want PWM. You don't change the width of the pulses for steppers, you change the frequency of the whole train, with the pulses normally being 50:50 mark space. The PWM modules are the 'wrong tool for the job'....

You use a lookup table for the phases, and a timer interrupt to give the change timings. There are two different approaches here. You can either change the frequency of the timer to accelerate and decelerate or use a high frequency timer and a counter to control when the changes occur.
The former approach is in AN822 (Microchip application note). It is the easier one to do, unless you have a very fast PIC. Look at this note.
tim_sid



Joined: 11 Apr 2014
Posts: 16

View user's profile Send private message

PostPosted: Mon Dec 15, 2014 2:22 am     Reply with quote

Thanks Ttelmah,
So i have to skip PWM, sure now i can go with timer and interrupts, i'll try some codes.
Thanks again.
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