I'm helping do a CNC conversion for a Taig mini lathe, and I'm hoping to get some advice about `translating` the control signals. We have bipolar stepper motors and Allegro driver chips salvaged from an older Epson printer, and I need to convert the signals coming out of the computer into a format that the chips can use.
The signal from the computer is of the 'step dir' sort. Two pins in the parallel port are used to control each motor. One pin is either high or low, indicating the direction of the step, and the other pin gets pulsed low to signal a step (pulse width can be adjusted in the software between 5 and 15 uS).
The UDN2917EB driver chips (http://www.datasheetarchive.com/pdf-datasheets/Datasheets-304/64194.html) each take two phase signals (as well as many others for current control and such, but the phase pins are the relevant ones for this project). The two phase signals each control the phase or polarity of one of the two sets of coils inside the motor. If the motor is stepping continuously in one direction, the signal repeats every 4 steps.
To illustrate, here's the output from the computer, showing 8 steps in one direction:
Step pulses _|_|_|_|_|_|_|_|
Dir pin ______________
And the chip needs this signal:
Phase pin 1 HHLLHHLL
Phase pin 2 HLLHHLLH
Or, in other words:
p1 p2
1 1
0 1
0 0
1 0
1 1
0 1
0 0
1 0
To go the other direction the sequence just reverses: if we're at 1, 1 we go to 1, 0 etc.
We first attempted to do this using PIC 12F683 uCs with PICAXE firmware. The motors stepped nicely on the test bench, with the step pulse sent by hand, but when plugged into the computer they became erratic. I've since discovered how slow the PICAXE system is (a PICAXE basic command can take about 1000 times as long to execute as an assembly command) and I think the program was simply missing the pulses from the computer. I've looked at the computer output on a scope, and it looks like it's doing what it is supposed to.
I have a couple of questions for the forum:
1) Can anyone think of a simple enough way to do this using standard logic components, without a micro controller?
2) Do you think a PIC 12F683 programmed in assembly would be fast enough?
I know there are a variety of pre-fab stepper driver and translator products available, but we'd rather build one if possible.
Thanks for your help, and let me know if any more info is needed.
Adam
The signal from the computer is of the 'step dir' sort. Two pins in the parallel port are used to control each motor. One pin is either high or low, indicating the direction of the step, and the other pin gets pulsed low to signal a step (pulse width can be adjusted in the software between 5 and 15 uS).
The UDN2917EB driver chips (http://www.datasheetarchive.com/pdf-datasheets/Datasheets-304/64194.html) each take two phase signals (as well as many others for current control and such, but the phase pins are the relevant ones for this project). The two phase signals each control the phase or polarity of one of the two sets of coils inside the motor. If the motor is stepping continuously in one direction, the signal repeats every 4 steps.
To illustrate, here's the output from the computer, showing 8 steps in one direction:
Step pulses _|_|_|_|_|_|_|_|
Dir pin ______________
And the chip needs this signal:
Phase pin 1 HHLLHHLL
Phase pin 2 HLLHHLLH
Or, in other words:
p1 p2
1 1
0 1
0 0
1 0
1 1
0 1
0 0
1 0
To go the other direction the sequence just reverses: if we're at 1, 1 we go to 1, 0 etc.
We first attempted to do this using PIC 12F683 uCs with PICAXE firmware. The motors stepped nicely on the test bench, with the step pulse sent by hand, but when plugged into the computer they became erratic. I've since discovered how slow the PICAXE system is (a PICAXE basic command can take about 1000 times as long to execute as an assembly command) and I think the program was simply missing the pulses from the computer. I've looked at the computer output on a scope, and it looks like it's doing what it is supposed to.
I have a couple of questions for the forum:
1) Can anyone think of a simple enough way to do this using standard logic components, without a micro controller?
2) Do you think a PIC 12F683 programmed in assembly would be fast enough?
I know there are a variety of pre-fab stepper driver and translator products available, but we'd rather build one if possible.
Thanks for your help, and let me know if any more info is needed.
Adam