586,075 active members*
4,234 visitors online*
Register for free
Login
IndustryArena Forum > OpenSource CNC Design Center > OpenSource Software > How to code a step motor axis move?
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2006
    Posts
    25

    How to code a step motor axis move?

    Hi! I'd like to code a program that simply rotate a stepper motor in a direction and in the opposite using the lpt interface. I know I need to give a square waveform for every step and a square waveform for the direction (or nothing for the opposite direction) but I don't know the timings/frequency for each one and for each step how much the signal should be in high state and low state, can you help me? For example, my motor is 200 step/seconds so the frequency of the step signal should be 0,005 seconds but in this time which is the % of high state and lower state? Thanks in advance!

  2. #2
    Join Date
    Feb 2004
    Posts
    157
    Make a variable that you can adjust to control the pulse width. The speed of different cpu's will effect the speed of the data string out.
    www.bigbearcnc.com

  3. #3
    Join Date
    May 2006
    Posts
    12
    Hey Niggo,
    I think this page has the info you are seeking.
    www.cs.uiowa.edu/~jones/step

    DocTanner

  4. #4
    Join Date
    Feb 2006
    Posts
    71
    I am doing a simple setup with a parallel port for a motor at the moment.

    I will do it in fortran or c. But I didn't have a dos complier on the laptop I was going to use
    , well i didn't think it had but it seems to have qbasic on it so I have had the motor running unipolar
    with qbasic it's a simple as..

    out 888,[first step]
    out 888,[first step, and second step]
    out 888,[second step]
    out 888,[second step, third step]
    out 888,[third step]
    out 888,[third step, fourth step]
    out 888,[fourth step]
    out 888,[fourth step, first step]

    888 is lpt1[378h] look up 'parallel port qbasic'


    I had the above in a loop with a couple of nested delay loops wasting time between steps ..
    not pretty but I had the motor spinnning within a few minutes of turning the laptop on..

    Once you have seen it working it's pretty simple..
    I am not sure if i shoud stick with unipolar, or go bipolar. For testing
    I have 4 IRF540 fets bolted to an old bike swinging arm[well it was the only 'heatsink' in my junk] and am running the motor off car batteries with 2 car ballast resistors to limit the current. I have just cobbled together an old printer lead with some LED's for testing..

Posting Permissions

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