Re: [Gambas-user] Did anybody try to run stepper motors through paralel port
On 19/04/10 04:17, Zelimir Ikovic wrote: I wanted to know how predictable and reliable GAMBAS is when a reaction to real-world events is required. Let say that Java RealTimeSystem is intended only for suitable operating systems, which means that only a real-time operating system, such as QNX, is appropriate for implementing the JVM. So that means it depends on underlynig OS version ... Simply installing an RTS extension and renaming java.lang.Thread instances to javax.realtime.RealtimeThread will not turn the application into a real-time app. I just wanted to know what is Gamas reaction to real world compared under different underlyng OS. FreeBSD, OpenBSD and Linux are not he same. --- On Sun, 4/18/10, Les Hardy l...@webmayo.com wrote: From: Les Hardy l...@webmayo.com 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, 12:27 PM Doriano Blengino wrote: 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. Yes, I agree. I did a lot of work with parallel ports in the past, but I would not attempt a serious application for that job in Gambas. Since I retired, I have been building my own hobby CNC machines, but I just use EMC2. It is GPL, and very efficient, so I figured I had no need to write my own app. Les Hardy To get a feeling what is doable you can use the timer command for benchmarking. Example: PUBLIC SUB Benchmark() DIM startTime AS Float DIM stoptime AS Float DIM i AS Integer FOR i = 1 TO 10 startTime = Timer 'whatever you want to benchmark comes next 'in this case we time a wait for an empty event queue WAIT 'end of benchmarked code stoptime = Timer PRINT Waiting took ((stoptime - startTime) * 1000) msecs NEXT END The above benchmark takes between 8 and 18 microseconds on my machine. Regards Werner -- Download Intel#174; 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
Re: [Gambas-user] Did anybody try to run stepper motors through paralel port
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 Hi, First of all, I apologise for giving winxp help in a Gambas mailing list, I will make it brief. Parallel port access change when winxp came along. It was not so easy to get direct access to the port, and some versions of winxp look for devices by periodically writing to the port. This is may be the cause of poor motion. This can be fixed by setting the 'DisableWarmPoll' key in the registry. || -- Download Intel#174; 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
Re: [Gambas-user] Did anybody try to run stepper motors through paralel port
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 1 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#174; 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
Re: [Gambas-user] Did anybody try to run stepper motors through paralel port
Doriano Blengino wrote: 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. Yes, I agree. I did a lot of work with parallel ports in the past, but I would not attempt a serious application for that job in Gambas. Since I retired, I have been building my own hobby CNC machines, but I just use EMC2. It is GPL, and very efficient, so I figured I had no need to write my own app. Les Hardy -- Download Intel#174; 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
Re: [Gambas-user] Did anybody try to run stepper motors through paralel port
I wanted to know how predictable and reliable GAMBAS is when a reaction to real-world events is required. Let say that Java RealTimeSystem is intended only for suitable operating systems, which means that only a real-time operating system, such as QNX, is appropriate for implementing the JVM. So that means it depends on underlynig OS version ... Simply installing an RTS extension and renaming java.lang.Thread instances to javax.realtime.RealtimeThread will not turn the application into a real-time app. I just wanted to know what is Gamas reaction to real world compared under different underlyng OS. FreeBSD, OpenBSD and Linux are not he same. --- On Sun, 4/18/10, Les Hardy l...@webmayo.com wrote: From: Les Hardy l...@webmayo.com 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, 12:27 PM Doriano Blengino wrote: 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. Yes, I agree. I did a lot of work with parallel ports in the past, but I would not attempt a serious application for that job in Gambas. Since I retired, I have been building my own hobby CNC machines, but I just use EMC2. It is GPL, and very efficient, so I figured I had no need to write my own app. Les Hardy -- 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#174; 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
Re: [Gambas-user] Did anybody try to run stepper motors through paralel port
On 19/04/10 04:17, Zelimir Ikovic wrote: I wanted to know how predictable and reliable GAMBAS is when a reaction to real-world events is required. Let say that Java RealTimeSystem is intended only for suitable operating systems, which means that only a real-time operating system, such as QNX, is appropriate for implementing the JVM. So that means it depends on underlynig OS version ... Simply installing an RTS extension and renaming java.lang.Thread instances to javax.realtime.RealtimeThread will not turn the application into a real-time app. I just wanted to know what is Gamas reaction to real world compared under different underlyng OS. FreeBSD, OpenBSD and Linux are not he same. --- On Sun, 4/18/10, Les Hardy l...@webmayo.com wrote: From: Les Hardy l...@webmayo.com 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, 12:27 PM Doriano Blengino wrote: 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. Yes, I agree. I did a lot of work with parallel ports in the past, but I would not attempt a serious application for that job in Gambas. Since I retired, I have been building my own hobby CNC machines, but I just use EMC2. It is GPL, and very efficient, so I figured I had no need to write my own app. Les Hardy I have used Gambas for on-screen scrolling of large screens with a 3ms tick rate and it was pleasing to the eye (meaning no discernible jitter). The minimum time resolution - as I understand it - is 1 ms at present. You can of course calibrate your own timing loops if your application is the only job the computer has to do. Regards Werner Dahn -- Download Intel#174; 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
Re: [Gambas-user] Did anybody try to run stepper motors through paralel port
Zelimir Ikovic ha scritto: I wanted to know how predictable and reliable GAMBAS is when a reaction to real-world events is required. Let say that Java RealTimeSystem is intended only for suitable operating systems, which means that only a real-time operating system, such as QNX, is appropriate for implementing the JVM. So that means it depends on underlynig OS version ... Simply installing an RTS extension and renaming java.lang.Thread instances to javax.realtime.RealtimeThread will not turn the application into a real-time app. I just wanted to know what is Gamas reaction to real world compared under different underlyng OS. FreeBSD, OpenBSD and Linux are not he same. I understand but, let me say, your sample code had nothing to do with realtime... it was simply fast as much as possible, without any mechanism to ensure some kind of real-time response to some event. To only read a counter is not enough. I can run 4 stepper motors directly (no step+direction, but driving the phases directly instead) with a CPU more than 100 times slower than a x86 CPU. But this is possible using interrupts. Practically every OS can, in some way, use interrupts - gambas can not. So, the only way in gambas to do precise timing is to let it run alone, with maximum priority and privileges. Or, to delegate high timing precision to some external piece of software (a libray or a driver) which can take advantage of interrupts, or callbacks, or signals. On the other hand I think that gambas can, with tight loops, do delays like you did in the original source. Surely it is predictable enough to let you calculate in some way the correct amount of cycling to obtain the needed delay - the fact is that gambas will never be the only thing running on the system, and you have little control about that. The same problem of windows xp - if you want precise timing, you must obtain privileges, either for the program or using a driver. I must also add that, without particular precautions, linux is more predictable about sleep() than win2000 or xp. Regards, -- Doriano Blengino Listen twice before you speak. This is why we have two ears, but only one mouth. -- Download Intel#174; 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
Re: [Gambas-user] Did anybody try to run stepper motors through paralel port
I use Gambas for nearly real-time work and it performs remarkably well, actually quite impressed. Far better than VB I have a data stream at 13.5 Kbps coming in from a remote modem requiring immediate work and turn around output. It might not seem like a fast stream, but the remote end requires a response immediately otherwise there are resends. It works! Gambas 1.0.19 graphical, FC4, samba Longest running time was about 420 days sans error. Some rules to follow: multiple core if you have it: good! remove unneed cron jobs. reduce overhead. turn swap off. Very clean efficient programming as possible -Fernando -- Original Message --- From: Doriano Blengino doriano.bleng...@fastwebnet.it To: mailing list for gambas users gambas-user@lists.sourceforge.net Sent: Sun, 18 Apr 2010 23:07:55 +0200 Subject: Re: [Gambas-user] Did anybody try to run stepper motors through paralel port Zelimir Ikovic ha scritto: I wanted to know how predictable and reliable GAMBAS is when a reaction to real-world events is required. Let say that Java RealTimeSystem is intended only for suitable operating systems, which means that only a real-time operating system, such as QNX, is appropriate for implementing the JVM. So that means it depends on underlynig OS version ... Simply installing an RTS extension and renaming java.lang.Thread instances to javax.realtime.RealtimeThread will not turn the application into a real-time app. I just wanted to know what is Gamas reaction to real world compared under different underlyng OS. FreeBSD, OpenBSD and Linux are not he same. I understand but, let me say, your sample code had nothing to do with realtime... it was simply fast as much as possible, without any mechanism to ensure some kind of real-time response to some event. To only read a counter is not enough. I can run 4 stepper motors directly (no step+direction, but driving the phases directly instead) with a CPU more than 100 times slower than a x86 CPU. But this is possible using interrupts. Practically every OS can, in some way, use interrupts - gambas can not. So, the only way in gambas to do precise timing is to let it run alone, with maximum priority and privileges. Or, to delegate high timing precision to some external piece of software (a libray or a driver) which can take advantage of interrupts, or callbacks, or signals. On the other hand I think that gambas can, with tight loops, do delays like you did in the original source. Surely it is predictable enough to let you calculate in some way the correct amount of cycling to obtain the needed delay - the fact is that gambas will never be the only thing running on the system, and you have little control about that. The same problem of windows xp - if you want precise timing, you must obtain privileges, either for the program or using a driver. I must also add that, without particular precautions, linux is more predictable about sleep() than win2000 or xp. Regards, -- Doriano Blengino Listen twice before you speak. This is why we have two ears, but only one mouth. -- Download Intel#174; 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 --- End of Original Message --- -- Download Intel#174; 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
Re: [Gambas-user] Did anybody try to run stepper motors through paralel port
Thank you all, in last few emails is answer! --- 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, 2:07 PM Zelimir Ikovic ha scritto: I wanted to know how predictable and reliable GAMBAS is when a reaction to real-world events is required. Let say that Java RealTimeSystem is intended only for suitable operating systems, which means that only a real-time operating system, such as QNX, is appropriate for implementing the JVM. So that means it depends on underlynig OS version ... Simply installing an RTS extension and renaming java.lang.Thread instances to javax.realtime.RealtimeThread will not turn the application into a real-time app. I just wanted to know what is Gamas reaction to real world compared under different underlyng OS. FreeBSD, OpenBSD and Linux are not he same. I understand but, let me say, your sample code had nothing to do with realtime... it was simply fast as much as possible, without any mechanism to ensure some kind of real-time response to some event. To only read a counter is not enough. I can run 4 stepper motors directly (no step+direction, but driving the phases directly instead) with a CPU more than 100 times slower than a x86 CPU. But this is possible using interrupts. Practically every OS can, in some way, use interrupts - gambas can not. So, the only way in gambas to do precise timing is to let it run alone, with maximum priority and privileges. Or, to delegate high timing precision to some external piece of software (a libray or a driver) which can take advantage of interrupts, or callbacks, or signals. On the other hand I think that gambas can, with tight loops, do delays like you did in the original source. Surely it is predictable enough to let you calculate in some way the correct amount of cycling to obtain the needed delay - the fact is that gambas will never be the only thing running on the system, and you have little control about that. The same problem of windows xp - if you want precise timing, you must obtain privileges, either for the program or using a driver. I must also add that, without particular precautions, linux is more predictable about sleep() than win2000 or xp. Regards, -- 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#174; 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
[Gambas-user] Did anybody try to run stepper motors through paralel port
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 -- Download Intel#174; 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
Re: [Gambas-user] Did anybody try to run stepper motors through paralel port
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 If you use timers, then the interpreter maintains a list of all timers, and knows how long it should wait before the next timer must be raised. If the interpreter must wait more than 10 ms, then he sleeps inside the select() system call. If he must wait less than 10 ms, then he enters a busy loop that takes 100% CPU before doing the select() system call once with a timeout of zero. Otherwise, if you don't use timers, you can use: - The WAIT instruction. This instruction runs an event loop, so you have the same behaviour as above. - The SLEEP instruction, which uses the nanosleep() system call. At the moment, SLEEP does not do busy loops for very small delays. This may change in the future, in Gambas 3. Regards, -- Benoît Minisini -- Download Intel#174; 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