PIC 16F84 Pulse Width Modulation Stepper Translator
Posted by
dqrwagoner
on 2003-04-27 19:38:52 UTC
To All,
I am uploading this into the public domain in the hopes that an
individual building thier own CNC controller may find it helpful.
The program file and some hex files are in the files section under
JPWMSTEP.
I wrote the JPWMSTEP software as a way of playing with the aspects
of controlling stepper motors using pulse width modulation. I built
a 2 axis controller for my Sherline lathe and milling machine that
was based on the JSTEP.JAL stepper translator I wrote over a year
ago.
It controls the axis selection and speed and it worked quite well,
but
I noticed that it was "clunky" at very low speeds. Soooo, not wanting
to change my hardware I begin playing with arrays of state tables in
order to keep it fast and simple and this way I did not have to
fiddle
with timers and I could adjust the pulse patterns the way I liked.
Like the JSTEP.JAL program it is written in JAL, the freeware JAL
compiler that was created for the PIC line of processors. The program
is looking at the inputs and updating the outputs at 20KHz. So at 4
states per step this works out to 5KHz maximum input frequency. Above
that and the software will start alising through the arrays of state
tables and the outputs will be eratic at best. At a maximum of 5KHz
input for a 100 step motor that's 50pps or 3000rpm. Thats good enough
for me!
This version has the same pinout as my JSTEP.JAL program and the
orginal STEP.ASM written by DAK Engineering (Maker of Turbo CNC) so
an
"upgrade" is possible. The program has 2 modes a half step mode and a
quarter step mode. This gives the user 200 and 400 steps for a 100
step
motor. I had tried 6 and 8 state versions but the tables were too
large,
so I settled on 4 states.
The files include the following:
JPWMSTEP.JAL - My original JAL source code.
JPWMSTEP20.HEX - A 20MZ version.
JPWMSTEP10N.HEX - A 10MZ, version.
JPWMSTEP2.HEX - A 4MZ version.
As always, please use this program a your own risk.
Best Regards
David Q. R. Wagoner
I am uploading this into the public domain in the hopes that an
individual building thier own CNC controller may find it helpful.
The program file and some hex files are in the files section under
JPWMSTEP.
I wrote the JPWMSTEP software as a way of playing with the aspects
of controlling stepper motors using pulse width modulation. I built
a 2 axis controller for my Sherline lathe and milling machine that
was based on the JSTEP.JAL stepper translator I wrote over a year
ago.
It controls the axis selection and speed and it worked quite well,
but
I noticed that it was "clunky" at very low speeds. Soooo, not wanting
to change my hardware I begin playing with arrays of state tables in
order to keep it fast and simple and this way I did not have to
fiddle
with timers and I could adjust the pulse patterns the way I liked.
Like the JSTEP.JAL program it is written in JAL, the freeware JAL
compiler that was created for the PIC line of processors. The program
is looking at the inputs and updating the outputs at 20KHz. So at 4
states per step this works out to 5KHz maximum input frequency. Above
that and the software will start alising through the arrays of state
tables and the outputs will be eratic at best. At a maximum of 5KHz
input for a 100 step motor that's 50pps or 3000rpm. Thats good enough
for me!
This version has the same pinout as my JSTEP.JAL program and the
orginal STEP.ASM written by DAK Engineering (Maker of Turbo CNC) so
an
"upgrade" is possible. The program has 2 modes a half step mode and a
quarter step mode. This gives the user 200 and 400 steps for a 100
step
motor. I had tried 6 and 8 state versions but the tables were too
large,
so I settled on 4 states.
The files include the following:
JPWMSTEP.JAL - My original JAL source code.
JPWMSTEP20.HEX - A 20MZ version.
JPWMSTEP10N.HEX - A 10MZ, version.
JPWMSTEP2.HEX - A 4MZ version.
As always, please use this program a your own risk.
Best Regards
David Q. R. Wagoner