View previous topic :: View next topic |
Author |
Message |
tim_sid
Joined: 11 Apr 2014 Posts: 16
|
Stepper With PWM |
Posted: Sun Dec 14, 2014 9:31 pm |
|
|
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: 1933 Location: Norman, OK
|
|
Posted: Sun Dec 14, 2014 9:58 pm |
|
|
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
|
|
Posted: Mon Dec 15, 2014 1:04 am |
|
|
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: 19497
|
|
Posted: Mon Dec 15, 2014 2:05 am |
|
|
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
|
|
Posted: Mon Dec 15, 2014 2:22 am |
|
|
Thanks Ttelmah,
So i have to skip PWM, sure now i can go with timer and interrupts, i'll try some codes.
Thanks again. |
|
|
|