[Coco] [coco] Coco CNC
Robert Gault
robert.gault at worldnet.att.net
Thu Feb 21 09:10:22 EST 2008
Mark Marlette wrote:
> George,
>
> Are you running OS-9 Level 2 or NitrOS-9 Level2?
>
> Mark
> Cloud-9
>
> At 2/20/2008 11:29 PM, you wrote:
>
>> I just finished a test with Basic09.
>>
>> The book says that if you "pack" a program, it will run faster.
>>
>> NOT!
>>
>>
>> I ran a series of four routines to move all three axis back to the
>> home position. One calls upon the other three.
>>
>> Running the same routine from Basic09, it took 2:41 (minutes/seconds)
>> Running the same routine with a "Packed" procedure, it took 2:41
>> (minutes/seconds)
>>
>> I can see the advantage of having it packed into a procedure if RunB
>> and the procedure is in memory and it will be called upon often.
>> However, for development purposes, there is no advantage in packing
>> this stuff. It goes no faster if packed.
>>
>> Bummer.
>>
>> I've also learned that the multitasking in OS-9 is not what it
>> purports to be. If I run procedures in more than one window, it does
>> each one in about 1/5 second increments. Maybe more time on each one.
>> I'll have to test this accurately to see what it really does, I'm only
>> guessing right now.
>>
>> I still love this OS and I would't trade it for the world!
>>
>> I can see that usiing interupts is the way to go for REAL multitasking.
>>
>> Alas, Basic09 is my thing and I will have to live with it until I have
>> time to learn assembly language. But for now, I'm really busy making
>> this CNC machine do what I need. Learning assembly would totally shut
>> down the progress on this CNC machine until I learn how to do a new
>> programming language. So, Basic09 it is.
>>
>> Another bummer.
>>
>> So far, I'm really pleased with how this thing is working. Accuracy is
>> as I wanted, repeatability is EXACTLY what I wanted and the thing
>> really looks good.
>> Soon, I'll have to take it apart and paint it. Yet another bummer.
>> However, it must happen... I think.
>> I'm not so sure I need to do that. WD-40 will protect it and it will
>> always be indoors. The steel parts are only in the frame work and the
>> imortant parts are either stainless, aluminum or brass. So, perhaps
>> it's okay the way it is.
>>
>> I'll post the generic programs to operate this thing to the website
>> when I get a chance.
>> Meanwhile..
>> www.coco.thetinbox.com
>>
>>
>>
>> George
>>
While NitrOS-9 will run faster than OS-9, I doubt that is the issue here.
George, when you say "The book says that if you "pack" a program, it
will run faster. NOT!", you need to consider exactly what you are asking.
Packed Basic09 programs run faster because it takes less time to go from
the packed code to ml code than it does to go from an ascii statement to
ml code. That is RunB can skip much of the interpretation required for
Basic09.
The real question is what is the limiting factor (regards time of
packed v non-packed programs) for the operation you are requesting. If
you are measuring the time it takes for your shaper or lathe to perform
an operation, that is the limiting factor not the Basic09 code. If you
are measuring the time for a Basic09 program to run where it does not
interface with the real world, then the limiting factors will how many
lines of the program are numbered, the ratio of integers to reals, and
the type of math being used.
You certainly don't want to pack your programs during the development
stage because you can't make changes to packed programs. You pack your
code when you believe there will not be any changes for the foreseeable
future.
OS-9 has never claimed that programs can run simultaneously. In fact,
no operating system can claim this unless it has duplicate hardware
including CPU cores. The claim is that "OS-9 is a multiprogramming
operating system." This is accomplished by time sharing.
If your complaint is that too much time is spent on each process
running before the next one kicks in, you can give processes different
priorities to better balance the time each one gets. I don't think
priorities are an option for Basic09 programs but it may be possible.
Within limits, you can control the minimum number of ticks given to a
process. The limit is the use of the 60Hz interrupt which generates the
ticks. You want each process to get more ticks than the system takes to
cycle through the processes.
What you want to do regards your programs, is remove line numbers as
much as possible, convert as many variables from real to integers as
possible, pre-calculate as many equations as possible, and be selective
in your choice of math operations. For example if you need 2*X, keep in
mind that addition of reals takes 440 cycles while multiplication takes
990. So X+X is 440 cycles while 2*X is 990. Which operation should be in
your program?
More information about the Coco
mailing list