Dear Mr. Darren Wright,
I hope you can help me in reviving this project. I am quite experienced in
VB but am quite a newbie in CNC and motor control. I hope you can explain to me a couple of things in the function Move_Steppers (in the "main" form):
1. Why did you choose CreateWaitableTimer approach for timing control? It appears that its nanosecond resolution is an overkill for this since this function needs to be called 50,000 times a second at most for a regular microstepper controller. So, we only need 20 ms resolution which is attainable with regular
VB timer. There is also a more precise ActiveX timer available at
http://www.easycode.cat/English/ActiveX.htm which is easy to use in
VB.
2. To increment time between the motor steps you are using mySleeper.SleepTime to evoke GoToSleep in the CSleeper. During each increment, you are switching between the STEP and STOP states while the joystick is kept activated. During the STOP state, you send 0 to the step line but keep the value for the direction line.
Then, at the end of the function, you send 0s to all lines but just briefly (probably a few nanosecs) until the function is called again and output is set to the next state. Is this nanosec-long zeroing of outputs between states important?
Thank you,
Victor