587,822 active members*
2,920 visitors online*
Register for free
Login
Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2004
    Posts
    445

    STEP and DIR Requirements

    Hi there,

    My electronic skills are quite limited, but I am trying to improve them. So far, my experience can be summed up in one project - a tachometer. It was based around an Atmel 8052 microcontroller. All it did was basically count the number of pulses from a hall effect sensor in 1 second and then display the RPM on a 16x2 LCD.

    In the not-too-distant future (like in a few months time), I am hoping to experiment a bit with controlling stepper motors using an 8052. I'm not entirely sure how to approach this, but had a few ideas and was looking for some suggestions and ideas (and criticism, provided it doesn't hurt my feelings too much ).

    A thought I had, was to use a readily available control board (something like a Xylotex board). The motors would then obviously be connected up to this and the STEP and DIR signals would be provided by the 8052. The first question is whether this basic idea is feasible?
    ie. 8052 MCU > Xylotex (or similar) > stepper motors.

    If the above is feasible, my next question is what are the requirements for STEP and DIR signals for a board like the Xylotex? With my current 'understanding', the DIR line is either held high or low and this decides direction of rotation, while a high/low transition on the STEP line will cause the motor to advance one step. Am I correct so far?

    If I am correct up to here, then what would the specific requirements be on the STEP and DIR signals? How long does each need to be held etc etc?

    I hope this post makes sense - I guess I'll soon find out...

    Regards
    Warren
    Have a nice day...

  2. #2
    Join Date
    Feb 2005
    Posts
    578
    You’re on the right track, if you really want to spin a motor with a micro.

    The Step and Dir signals usually come from a PC parallel port, so a duration of say 2 to 5 micro seconds should work on most controllers (for a minimum). To make it more universal, I would recommend that you send out Dir first (as you mentioned), followed by Step. Think of Dir as a control signal and Step as a pulse. You only need to output Dir when you want to change directions.

    Steve

  3. #3
    Join Date
    Jun 2004
    Posts
    445
    Hi Steve,

    Thanks for the reply. It's good to hear that I'm not living entirely in my own little dream world.

    I know I only asked for durations, but I'm not quite sure exactly what is meant by a duration of 2 to 5 micro seconds. Does this mean that the DIR needs to be kept, say high, for 2 - 5 microseconds before the STEP transition takes place and that the STEP line has to stay low for at least 2 - 5 microseconds and then the DIR has to stay high again for another 2 - 5 microseconds after the STEP transition?

    Also, if I only wanted a motor to run continuously in one direction only, could I just keep the DIR line high or low permanently without even taking it through the MCU?

    Thanks
    Warren
    Have a nice day...

  4. #4
    Join Date
    Mar 2003
    Posts
    35538
    The direction only changes when you need to change direction. Always high or always low.

    Some drives like the step to be either active high or active low. Most software let's you choose which.
    Gerry

    UCCNC 2017 Screenset
    http://www.thecncwoodworker.com/2017.html

    Mach3 2010 Screenset
    http://www.thecncwoodworker.com/2010.html

    JointCAM - CNC Dovetails & Box Joints
    http://www.g-forcecnc.com/jointcam.html

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  5. #5
    Join Date
    Feb 2005
    Posts
    578
    Sorry, I could have been clear. If it was me, I would change DIR if needed, wait 2 uSec if I did change it, drop STEP wait 2 uSec, raise STEP (for an active low step device). You should probably wait for at least 2 uSec settle time before repeating, but you would need a really fast stepper before you needed to concern youself with this. Rather I would think you might have a problem slowing yourself down enough to do slow stepping.

    Like Gerry said, DIR only need to be fiddled with if you are changing direction.

    (I loved your work on the wankel, most fun to watch.)

    What ya going to do with this?

    Steve

  6. #6
    Join Date
    Jun 2004
    Posts
    445
    Hi,

    Thanks for clearing that up.

    My plan is to eventually get a small gear hobbing machine running. Traditionally, these machines have used vast numbers of gears and mechanical linkages to synchronise the hob with the workpiece and in order to cut different numbers and types of teeth, the gear ratios have to be changed. I would like to replace all of the mechanical synchronisation with electronic synchronisation using steppers/servos on my own machine. By doing it electronically, I will be able to easily change ratios, thereby allowing me to cut many different gears including such things as helical gears.

    The reason why I am interested in using a microcontroller for this, is because both the hob and workpiece will basically just be rotating in a single direction at a constant speed until the gear is cut. The main requirement is that they are properly synchronised. I see no point in 'wasting' a whole PC on this and it will be more fun trying to get it to work using the 8052.

    I think you are right about slowing the stepping down. I'm going to have to sit down and think about how I'm going to split the use of the timers up. Before I get to this project though, I have at least one other 'big' project to finish first.

    Regards
    Warren
    Have a nice day...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •