CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2006
    Location
    Saudi arabia
    Posts
    76

    [RESOLVED] Stepper Motor Help!!!

    I have created a program using inpout32.dll to run my stepper motor .
    I can run stepper motor now but the problem is its running very slow! is there any better way i can run my motor fast as i want.


    i used following method.
    ............................................................................
    Code:
    option explicit on
    Dim myTime as object
    
    public sub Form1
    
    mytime=2000
    out(888,3)
    do untill mytime=0
    mytime=mytime-1
    loop
    mytime=2000
    out(888,1)
    do untill mytime=0
    mytime=mytime-1
    loop
    end sub
    ......................................................................
    if i set the value of mytime less then 2000 my motor does'nt work at all.
    so please help me
    i tried also with the timer tool and i wrote the code in the tick event of timer but it is also very slow.
    please help me how i can gain my motor speed.
    Last edited by HanneSThEGreaT; May 26th, 2009 at 03:02 AM.
    Thank You Guru's

  2. #2
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Stepper Motor Help!!!

    Why are you defining my time as object but using it as an Integer?

    What does Out() do. All I can see in your code is a couple of simple loops that should complete almost instantly other than whatever may happen in out() which you did not provide.

  3. #3
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Stepper Motor Help!!!

    You can use SLEEP to wait 2 seconds

    Code:
    option explicit on
    Dim myTime as Integer
    
    public sub Form1
    
    mytime=2000
    out(888,3)
    sleep(mytime)
    out(888,1)
    sleep(mytime) ' if you even need that one
    
    end sub
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  4. #4
    Join Date
    Jun 2006
    Location
    Saudi arabia
    Posts
    76

    Re: Stepper Motor Help!!!

    thank you dglienna and DATAMISER.
    Sleep methode really work well.
    Is there any more ways i can run my motor fast???
    Last edited by waqasanjum; May 26th, 2009 at 09:16 PM.
    Thank You Guru's

  5. #5
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Stepper Motor Help!!!

    Probably not, as the motor doesn't report anything back. You might be able to set up some other kind of device that reports what the motor actually did, and when...
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured