588,265 active members*
10,096 visitors online*
Register for free
Login
IndustryArena Forum > CNC Electronics > CNC Machine Related Electronics > step/dir conversion via 2 bit counter
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2012
    Posts
    39

    step/dir conversion via 2 bit counter

    I have one tiny bottleneck left between the parallel port and my bipolar stepper drivers. In case anyone else has traveled this path, I'll describe it...as I understand it, so maybe it'll save you some time...or if I'm wrong, someone can correct me as well as prevent you from traveling down dead end paths.
    The signal from the paraport is on two pins, one for direction of rotation and the other to take a step that way. The electronics has to decide which way to go when the step is called for.
    A two bit up/down counter has a pin to tell it which way to count (direction), up or down. It has another input that tells it when to count (step). It outputs both bits when it changes them. Below is the sequence it outputs.

    clock
    pulse Most Significant Bit Least Significant Bit
    1 0 0
    2 0 1
    3 1 0
    4 1 1

    My steppers are wired so that a high signal energizes a motor winding one way while a low signal reverses polarity on the coil, one pin per coil, two pins per motor. The output sequence needed for this setup is...

    step coil one coil two
    1 0 0
    2 0 1
    3 1 1
    4 1 0

    As you can see, the first two steps are right. Only the lsb is wrong when msb is high. I believe I could put a tri-state switch on the lsb's output and keep it in high impedance mode when the msb is low, but have it route lsb's signal through an inverter when msb is high but that's adding two more chips to my board and I'm hoping someone can think of a simpler solution.
    When the counter's direction input is changed, this sequence will occur in reverse, btw.

  2. #2
    Join Date
    Jan 2005
    Posts
    364
    I have used similar circuits in the past and there were 2 chip's needed except for this one wich uses a PIC:

    DAK Engineering - U2 Stepper Translator

  3. #3
    Join Date
    May 2012
    Posts
    39
    The answer was staring at me from the logic truth tables.
    By driving both inputs of an xor gate with the output of the counter and using the xor's output as the lsb, it inverts lsb when msb is high, creating exactly the pattern I needed.

  4. #4
    Join Date
    May 2012
    Posts
    39
    Update for anyone on a similar path to my own. It seems that LinuxCNC has an optional output mode under HAL (Hardware Abstraction Layer?) that sends quadrature instead of step/direction signals through the parallel port. I haven't quite figured it out yet in total but I believe it uses the type 2 setting via the stepgen (software step generator) . There are 2 options...position or velocity...whose larger meaning hasn't impinged fully on my understanding yet. More study <sigh> <grin>.
    It will slow down your maximum speed tho, since the computer has to use clock cycles to create those steps rather than being handled by the hardware in the stepper electronics. Since I have a very low powered mill (dremel) I think i can live with slower for now.

Similar Threads

  1. X3 CNC Conversion- the new red-headed-step-child
    By WOTDesigns in forum X3/SX3/G0619/G0463
    Replies: 137
    Last Post: 02-10-2015, 08:49 AM
  2. Getting STEP pulses counter from board
    By igrek in forum Dynomotion/Kflop/Kanalog
    Replies: 2
    Last Post: 02-04-2013, 06:04 PM
  3. Need help with cv/ccw - dir/step conversion
    By color 65 in forum Stepper Motors / Drives
    Replies: 2
    Last Post: 11-02-2011, 09:07 AM
  4. X3 CNC Conversion- the new red-headed-step-child
    By PriddyShiddy in forum Benchtop Machines
    Replies: 92
    Last Post: 07-04-2011, 11:56 PM
  5. 4 phase input to Step/Dir conversion?
    By Konstantin in forum CNC Machine Related Electronics
    Replies: 12
    Last Post: 02-11-2007, 05:40 AM

Tags for this Thread

Posting Permissions

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