[Gambas-user] Did anybody try to run stepper motors through paralel port

Doriano Blengino doriano.blengino at ...1909...
Sun Apr 18 23:07:55 CEST 2010


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."





More information about the User mailing list