View Full Version : The "I" macro variable
Shizzlemah 05-13-2007, 04:01 PM Hello guys.
I am trying to write a program that uses the I macro variable. Not I as in IJK, this is I as in IO.
Section 18 of the manual says that the I(x) macro will return the state of various inputs to the control and I am looking specifically at I(7), the touch probe state.
(I am aware of and do not want to use G31, G31.1, L9101, etc - simply want to know the status of the probe without making a move)
I've tried a bunch of things to get the value of I(7) into a variable, including
V5=I(7) like written in the manuals, and V5=I7 like referencing a fixture offset "FX3" for example. Anyway, it just keeps barfing on the code telling me that I have an error.
I know there must be a way to accesss these functions, else why would they be in the manual ?
One thing I think of now that I didnt try would be
#IF ( I7 ) THEN GOTO :TURNONPROBE
Any thoughts oh great gurus ?? Maybe my brain just isn't working but I could use a little pointer here!
:drowning:
fizzissist 05-14-2007, 09:23 PM I think the easiest thing for us gurus (...place ROFLMAO smiley here...) would be for you to place what code you've got so far here so we can see if it's a simple syntax issue...
Looks to me like I(7) is the probe, an absolute, and changing the number is a hard function change, so you don't really treat "I" like a variable in the sense of assigning a changing value.
Me thinks an If-Then GoTo statement should work, but the TURNONPROBE is where the I(7) would be invoked....
Neil?????
Scott_bob 05-14-2007, 11:45 PM another common issue with the Fadal macro is this little command:
WAIT
I forget the proper syntax, but you should be able to see that in your manual. It seems that sometimes the processor needs a delay which the "wait" command provides. Give this a try, remember one change at a time so you can figure out what is going on.
fizzissist 05-15-2007, 09:27 AM If you have someone else running the parts, you could program in a variable 'G4 Pnn' (pause) command, where 'nn' is set to change relative to the number of cycles, or the operator inputs his age....us older guys get a longer pause...
Haven't figured out how to make it a random number, but that could drive an operator nuts!
Actually, you may have a point, where the system needs some time to react...but since I'm not using my probe that way, I should just shut up and let somebody address this that knows... :)
Shizzlemah 05-15-2007, 09:44 AM Ok guys I can give a little more info for this one. First off this is on a legacy 88HS (which I really like BTW)
The I(x) function is supposed to return a 1 or 0 based on the status of various control inputs. Like : is the probe touching ? is the door open ? is there enough lube in the reservoir ? is the spindle oriented ? toolchanger home ? etc....
I(x) is only an input. Can not assign it a value. Related values: O(x) are outputs, and G(x) is status of modal g-codes.
In my specific application, I have a probe that will turn itself off after a couple of minutes. One of those Renishaws with a centrifrugal switch- to turn it on you run it at 400RPM for a second, then stop and lock the spindle.
When the probe turns itself off, it goes into a "TOUCH" state. When it is on and clear of the workpiece, it is "NO TOUCH".
So my goal is to look at the state of the probe, and if it is on then I don't need to reinitialize it. Not a huge deal but it can save perhaps 10 seconds per part - and there are enough parts to make that savings very attractive.
The I(7) will also let me verify that the probe has turned on. Currently I use a really clunky routine for that, and getting it down to one line would be sweet.
English bastardized code, showing what I'd like to accomplish:
L0100 (Subroutine: is probe on? if not turn it on
M6T18 (load probe into spindle
:IsItOn
#WAIT; ( be sure the evaluation is done realtime, not buffered
IF (probe = touch) then goto :TurnOnProbe
IF (probe = notouch ) then goto :AlreadyOn
:TurnOnProbe
S350 M3
G4 P1000
M19
goto :IsItOn (verify that it turned on)
:AlreadyOn
M17 (end of L100)
Would also add something saying after 3 failed attempts wait for the operator, etc.
I have no problem with the gotos, subs, etc. Actually pretty proud about writing smart programs - wrote one last week that probed and identified the workpiece as one of 4 different parts and machined to suit. Just having a devil of a time getting it to acknowledge the I(x) variable!
I have tried the following code with no luck.
#V5=I7 ; letter-number like used with D, P, or FX array variables
#V5=I(7) ; letter-number in parenthesis like the example in the book
I'll give it three more headsmacks before I call Fadal. Mostly cuz I'm embarassed that I am missing like one charachter or something and Neal will laugh at me :-)
Shizzlemah 05-15-2007, 10:10 AM If you have someone else running the parts, you could program in a variable 'G4 Pnn' (pause) command, where 'nn' is set to change relative to the number of cycles, or the operator inputs his age....us older guys get a longer pause...
Haven't figured out how to make it a random number, but that could drive an operator nuts!
Not to derail my own thread, buuuuuutttttt:
#R9=CP
G4P+R9
CP is the clock value for total time the control is on :-)
I use CR (total time in run mode) to generate serial numbers for parts.
CC is the time spent so far on the current part.
HTH!
Shizzlemah--
I don't laugh at people (well maybe a little). Play with this concept:
#v32= I(7)
#IF V32=0 THEN GOTO :CONTINUE
#IF V32=1 THEN GOTO :TURNONPROB
Neal
Shizzlemah 05-16-2007, 12:27 PM N1 O1111 (I(X) TEST
N2 #PRINT I(7)
or
N2 #V32=I(7)
or
N2 #V32=I7
or
N2 #O(2)=1
or
N2 #V32 = G(1)
all give me "Illegal Expression In Line" :(
Anyone have an actual code snippet that I can try ??
This is on version 96.1B4-3 if that matters.
PS: Neal, you can laugh, esp when I order that 4meg ram upgrade!
Scott_bob 05-16-2007, 01:09 PM Shizzy,
That's when I'll laugh...
Let's see you could fly round trip 1st class, from New York to LA for what Fadal wants for that 4 Meg upgrade...
Shizzlemah 05-16-2007, 10:54 PM I'll be buying the memory - That's the funny part! 4 Meg for the price of 10 Gig. But what can I say, this Fadal makes money and hasn't been down at all in the 2 years it's been here.
Although I'd really freakin' love to save 8-10 seconds on each part with the damn I(7) variable....
|
|