Originally Posted by 109jb Thanks for the replies guys. The problem I have is that I need to be able to get a time reference with better than millisecond accuracy. Something that works like "TimeGetTime". The reason is because I may know that I need a certain amount of time to pass between step pulses, say 10 milliseconds, but I can't just have a 10 millisecond pause because the code that runs between each step pulse takes up some of that time. The amount of code run between each step can be different depending or if it's a straight line or arc, circle, etc., so the pause has to be different too. So as it is now, I have to be able to interrogate and calculate the elapsed time since the last step command. I currently have the code written to use TimeGetTime, and it seems to work well with that, but at only 1 ms resolution the best I can hope for is to have 60,000 steps per minute. With my stepper at 1000 steps per inch and using 1/4 step microstepping giving 4000 microsteps per inch yields only 15 inches per minute at best. I'd really like to be able to get about 100 IPM in rapid which would require stepping every 150 nanoseconds. Don't know if it's possible, especially in VB, but that's the way I have my code written right now.
John B. |
There is a much higher resolution timer available in the windows kernel. However, the overhead is in the order of microseconds not nanoseconds like you want. It's an API function....I'll forward you the the MSDN page instead of trying to explain it. The functions that you are interested in are QueryPerformanceCounter & QueryPerformanceFrequency.
Link