On Saturday, March 24, 2012 10:07:19 AM Erik Christiansen did opine:

> You're up bright and early on a Saturday morn, Gene. :-)
> 
> On 24.03.12 05:43, gene heskett wrote:
> > On Saturday, March 24, 2012 04:41:17 AM Erik Christiansen did opine:
> > > In a later post, it did sink in that a gcode subroutine has its own
> > > scope, so similarity to a 'C' block with the same properties yields
> > > a gain in "feel", I sense.
> > 
> > 'Scope' as I have found recently, isn't always global even if
> > intended.  I had to re-write some gcode step & repeat loops into much
> > longer stuff not too long ago because a globally defined #<_named>
> > var intended to pass a value back to the main program, simply
> > disappeared at the endwhile.
> 
> IIRC the declaration of that gcode global variable (initial assignment)
> was in the local scope, not the global one. Did you get around to
> retrying that with an initial
> 
> #<_fred> = 0
> 
> or similar in global scope, to make sure it was really global?
 
ISTR I did, but then apparently had 2 independent identically named 
variables that according to debug, statements, did not contain the same 
values.  So I just re-wrote the code.  No big deal at this late date, but I 
did want to make those who were 'kicking the tires' aware that there appear 
to be obscure scope problems with the #<_globalname> functions.  I suppose 
I should have used a #500 syntax to further refine the data, that should 
have been a bulletproof global, but did not at the time.  My fault of 
course but by then my back was about fini so I sat down at the lappy logged 
into it and rewrote it, in 2 files AIR.  But I need to see if I can put a 
normal usb keyboard on the lappy, the builtin one has a very high vacuum, 
it sucks IOW.

Working now on the lathe's controller box, I ran out to the shack yesterday 
& picked up another LM317T because I need 2 lower than 42 volt sources, one 
at about 16 to run the internal fan, an old 12 volt psu fan (I ran 2 of 
them in a previous box with a 4 wide xylotex board in it, on 19 volts, they 
screamed but never failed) and the other at about 5-5.1 for the logic on 
the cnc4pc C1G interface board.  In my travels, I picked up half a shoebox 
of Dale resistors that didn't pass .1% final test, so presetting those 
voltages will not be a problem.

But would you believe the shack no longer carries the insulator kits for 
hot tabbed TO-220's?  So I came home & spent the rest of the afternoon 
demolishing an Antec 600w psu that did the usual Antec failure, its 5 volts 
was down to 4.82, exactly 2 weeks out of warranty 2 years ago. 2nd time a 
high priced Antec has done that to me.  To get 2 only to-220 insulation 
kits out of it, and of course a huge supply on multicolored wires to finish 
up my box with.  So that goes in the box next.  I have some lexan, and am 
considering machining the lid to add a window above the C1G so I can see 
all them purty leds flickering away as it works.  I have to drill & tap for 
the standoffs that hold the board anyway, so the window is just a little 
more machining.

FWIW, the shack no longer carries db25 pieces to even make a parport cable.  
DigiKey to the rescue probably.  But no clue as to the minimum length I can 
get 25 conductor ribbon cable in. I might have some left over to sell you 
folks. :)

> Having just finished subroutines in the translator, I'm about to embark
> on while loops, and was just looking in the on-line doco for a
> declaration on whether they have their own scope. Your experience
> suggests that is the case. Then they should perhaps be demarcated in the
> same way as subroutines.

In the docs?  That too.

Suggestion: modify an area in the #100 to #5000 range by first removing the 
volatility of say #4000-#5000, and assign a hashing function that builds 
the global names into a lookup, starting at #4999 and building down as new 
names are encountered in the source file.  IOW, assign the 2nd level lookup 
of that name to #4999, the next such named to $4998 yadda yadda.  Do the 
same with the first level but build up from $4000.  The fly in that soup 
will of course be the size of the var, but with todays machines, an 8 byte, 
64 bit, fixed size would at least be consistent and not that profligate a 
waste of memory.  Declare a variable stack overflow if the two pointers 
meet, otherwise its invisible to us in the ditches making swarf as long as 
its fast enough.  That would allow 500 named vars, which in my little bitty 
mind should be enough, said of course in my best Bill Gates accent about 
640k.  :)

One of the things I found when doing the autoz functions for pcb work, was 
that vars assigned in the #100-#120 range (that was all I checked) weren't 
actually volatile unless the machine was power cycled.  I could shut 
LinuxCNC down, then start it back up and load a different .ngc file, run 
it, and when done hit F5 and have (debug, "100="#100) and the value I had 
stored there 3 hours earlier was still there.  But since it wasn't in the 
docs that way I didn't trust it, and wound up setting those presets up so 
they were usable in the g55-56 co-ordinate modes.  That worked well, but 
probably (again I didn't check, should have, beat me) not over a LinuxCNC 
restart and certainly not over a machine power cycle.

Thanks Erik.

Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
My web page: <http://coyoteden.dyndns-free.com:85/gene>
None love the bearer of bad news.
                -- Sophocles

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to