|
DRIVING STEP-MOTORS
by Axel Kilian
Hong Ma's help was crucial in helping to make it work (thank you)- I
used assembly code for programming the code through uing MPLAB by www.microchip.com
http://www.microchip.com/1010/pline/tools/software/index.htm
using a serial cable and the programming pic-chip dock The circuit for
driving the the steppermotors from the output ports of the PIC I found
on this site
http://eio.com/jasstep.htm
a pretty good introduction and tutorial about steppermotors and how to
drive it - the diagram is Figure 2.1 - I could take it pretty much literaly
as supplied using hex inverters MM74HC4049 and 10 K resistors and the
sN3904 powertransitors.
Through measuring the resistance between the cable pairs in the stppermotor
(it has 6 cables) we were able to single out the 2 centertab cables (see
figure 3.1) the resistance of the center tab to any of the other cables
is half of that of the cables going through the entire spool of the unipolar
steppermotor.
Next step was writing the assembly code for the PIC we used a template
and some code sniplet from another chip application and put it together
- see file f876tem2.asm f876tem2.asm
One problem I had with PIC was I had forgotten to tie MCLR to high (5V)
also the PIC needs to be supplied with a 20MHZ oscillator crystal (with
capacitors embedded - otherwise you have to add them one between both
outerpin and center pin) oscillator is directly conneted to CLKIN and
CLKout pins 9 and 10 of PIC. - power PIC at pin 20 VDD and ground it at
pin 19 VSS and PIN 8 VSS
The stepper motor driver cables go into the emitter of the four powertransitors
- sequence has to be tested by giving them pulses while connecting the
centertabs to 5V and see which direction it turns.
Then connect center tabs of steppermotor to external powersource that
corresponds to Voltage specs of the motor. Now driving the motor through
the assembly pattern should turn the motor the desired way.
assembly code - crucial is setting portB as output pin
1-4 in this case through the Hex number E1 - or 00011110
then loop through and set one of the pins high while others low to drive
the steppermotor with the correct pattern - the DLOOP sets the time between
each step.
|