To run a stepper we need 2 pins: one for direction: 0 is clckwise, 5V is CounterClockWise. Second pin is for stepping. I have to bring 5V and keep it for 200 nanosec or more with WAIT1 SUB then bring 0V, and then I need precise amount of time to wait. It has to be precise because speed of machine depends on it I have to wait let say between 100 and 10000 microsec. If I wait 100microsec machine will move at 10 inch per sec which is maximum I need
Here is how I do it in VB6 on win2000 (On winXP it is not smooth I feel machine will fall apart, and there is not help for this I try everything, only solution is WinXPembedded): ============================================== Public Sub WAIT1(w As Long) Dim kf As Long For kf = 1 To w Next kf End Sub ====================================== Public Sub WAIT2(s As Double) Dim c1 As Currency Dim c2 As Currency QueryPerformanceCounter c1 Do QueryPerformanceCounter c2 Loop Until ((c2 - c1 - overhead) / freq) > s End Sub ====================================== 'run this at begining of the program to measure freq Public Sub OVER() Dim CT1 As Currency Dim CT2 As Currency QueryPerformanceFrequency freq QueryPerformanceCounter CT1 QueryPerformanceCounter CT2 overhead = (CT2 - CT1) / freq End Sub ==== Public freq As Currency Public overhead As Currency ====================================================================== --- On Sun, 4/18/10, Doriano Blengino <doriano.bleng...@fastwebnet.it> wrote: > From: Doriano Blengino <doriano.bleng...@fastwebnet.it> > Subject: Re: [Gambas-user] Did anybody try to run stepper motors through > paralel port > To: "mailing list for gambas users" <gambas-user@lists.sourceforge.net> > Received: Sunday, April 18, 2010, 11:27 AM > Les Hardy ha scritto: > > Zelimir Ikovic wrote: > > > >> I have VB6 program that run CNC plasma machine. It > work very well and smooth under win200, but in WinXP machine > motion is not good. > >> > >> It doesnot help if I set REALTIME prority for the > process ... > >> > >> How about Linux and Gambas? Daes it depent on > version of Linux ... > >> > >> What is resolution for Gambas Timer? Can I wait 10 > microsec do something wait 10 microsec and so on ... > >> > >> Regards > >> > Uhm... under linux, no matter what version, you can use the > parallel > port and high resolution timers, but... 10 us? What is the > speed of your > motor(s)? > Anyway, I see it difficult to do it in gambas, mainly > because of tight > GUI integration and impossibility to use interrupts; the > best way would > be to separate hi-level logic from lo-level timing, perhaps > through a > library written in C. > > -- > Doriano Blengino > > "Listen twice before you speak. > This is why we have two ears, but only one mouth." > > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, > find bugs > proactively, and fine-tune applications for parallel > performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user