Stepper Motor and PWM enquiries

Status
Not open for further replies.

dannyboy

New Member
Anyone noes how to write the PWM codes in C to drive a stepper motor?
I'm currentll using a PIC18F452 and MPLAB 6.40 for the testing....

thanx!
 
dannyboy said:
Anyone noes how to write the PWM codes in C to drive a stepper motor?
I'm currentll using a PIC18F452 and MPLAB 6.40 for the testing....

thanx!

You wouldn't normally use PWM for a stepper motor (at least I wouldn't), you simply power the various coils in the sequence you want, full or half step, and for the direction you want. I don't see the use of PWM at all?.

I would probably do it using a table, with interrupt routines providing the stepping speed, with each step accessing the next entry in the table. It's probably easier to use seperate tables for forward and reverse, rather than try and step backwards through a table. For half stepping you simply use tables twice as long.
 
Some higher level driver support PWM for stepping motor. With those chips, you can use PWM to control your motor. However, as in my experiments, I used a table of control vectors as Nigel recommended.

By the way, you can see how control a stepping with Douglas W. Jones tutorial.
 
Thanx Nigel Goodwin & falleafd....

but do u guys have any examples on PWM or using tables for stepper motor??
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…