Results 1 to 9 of 9

Thread: how to reduce timer interval to 1 micro second

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2006
    Posts
    2

    how to reduce timer interval to 1 micro second

    HI, everybody....
    i m currently using printer parellel port to control stepper motor, in order to achieve high rotational speed, i need to send out pulses in microsecond interval....However, the minimum interval that VB timer can achieve is 1 milisecond only.......
    can anybody here help me to solve this problem????
    THX A MILLION!!

  2. #2
    PowerPoster gavio's Avatar
    Join Date
    Feb 2006
    Location
    GMT+1
    Posts
    4,462

    Re: how to reduce timer interval to 1 micro second

    I don't know if that's possible. Even with the Sleep function you are limited to a 1 millisecond.

    ... Welcome to the forums

  3. #3

  4. #4
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: how to reduce timer interval to 1 micro second

    Martin, that's accurate to about 1ms - about 1,000 times what cheongcy needs.

    cheongcy, driving a fast stepper in software, even in assembly, is a bit iffy, and the printer port, unless you're driving a stepper driver with it, isn't the hardware you want connected to a stepper motor (not enough current source, too susceptible to being blown by switching transients).

    A hardware oscillator driving a stepper driver is more accurate, even if you use a 4 MHz oscillator (a cheap resonator) and /4 as the fast frequency, and pretty simple to implement. Just switch to a couple of cascaded /1,000 stages (or whatever you need) for the slow stepping. Your software is then as simple as turning one bit on or off.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  5. #5

    Thread Starter
    New Member
    Join Date
    Aug 2006
    Posts
    2

    Re: how to reduce timer interval to 1 micro second

    well, i m actually using a driver to drive my stepper motor......
    the driver only requires 2 signals that is clock and direction from the parallel port.....
    i had tried to send out pulses wth 1ms interval, but the motor rotated in a very low speed....therefore i need a smaller time interval...........

  6. #6
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: how to reduce timer interval to 1 micro second

    What hapens when you send out impulses withought any pausing in between impulses ?
    something like this:
    VB Code:
    1. do
    2.     do_impulse
    3. loop until time_to_end
    Last edited by CVMichael; Aug 3rd, 2006 at 01:03 PM.

  7. #7
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: how to reduce timer interval to 1 micro second

    I'm going to guess that VB isn't going to execute that loop in less than a few tens of microseconds at best.

    @cheongcy, just feed the clock input with a (hardware-derived) signal that's fast enough to move the stepper at the speed you want. Then stick a divide-by between the clock source and clock input that you can set to /x and /1 by changing one line from +5 to 0.

    Or, another way, change the logic of the stepper controller (most of them are configurable) to produce faster steps with the same clock.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  8. #8
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: how to reduce timer interval to 1 micro second

    Quote Originally Posted by Al42
    I'm going to guess that VB isn't going to execute that loop in less than a few tens of microseconds at best.
    ....
    Yea... that's why I asked that question...

    I think hardware control is the only way, microseconds is way to fast for VB

  9. #9
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: how to reduce timer interval to 1 micro second

    Actually I think microseconds is too fast for a stepper motor. With even 16 poles, that's about 62,000 RPS (almost 4 million RPM) , if I'm doing it right. Something tells me that the stepper controller is set to do a very large divide of the clock input.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

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