Maybe this would work:
O9020;
#101=#20
M06;
POPEN;
DPRNT[T#101[20]];
PCLOS;
M99;
I am trying to interface an RS232 controlled device to a CNC mill with a Fanuc 21i control. The object is to send the tool number out the RS232 port via DPRNT command. This method has worked in the past very well in machines with a tool changer macro- just add the DPRNT sequence to the end of the macro.
Unfortunately, this machine (and others) doesn't have an ATC macro.
My current approach is to create a macro to "hijack" the M06 and add the DPRNT on after- like this:
Param 6080=6 (point M06 at macro O9020)
Param 6001 #1 =0 (force leading zeros)
O9020;
M06;
POPEN;
DPRNT[T#4120[20]];
PCLOS;
M99;
This works, but ONLY if the T-code is in a block by itself, followed by the M06 in a separtate block:
T15;
M06;
etc;
If the M06 follows the T in the same block
T15 M06;
the control displays an error (something about a T-command- didn't write it down) and stops running.
I would like to find a way to execute this DPRNT with any M06 presented in any format the control will accept it; ie, transparent to the user or programmer.
Any thoughts?
Marc
Maybe this would work:
O9020;
#101=#20
M06;
POPEN;
DPRNT[T#101[20]];
PCLOS;
M99;
Dcoupar-
Thanks for the quick reply!
I have tried something simaler in the past-
O9020;
M06 T#20;
POPEN;
etc;
But if I recall, this only worked with the format
M06 Txx;
The "Txx" was passed on as a variable (T= #20) and worked that way. Somehow, the T code is handled in a different way in the ATC logic- ladder, maybe?
My last go-round with this issue was with a Robodrill- I wound up using a "stand alone" M function macro that just did the DPRNT function; the programmer had to insert the additional M code after each tool change.
PS- Do you happen to know what param 9933 bit 7 does exactly? It seems to affect the operability of the DPRNT command.
Thanks again, and appreciate any more info you can provide!
Marc
Finally found the solution to my problem!
Param 9070 = 6
O9001
M6;
POPEN;
DPRNT[T#4120[20]];
PCLOS;
M99;
This seems to work with the Txx M06 in any order that the control accepts.
This uses a SUBPROGRAM called by M-function instead of a macro called by M function.
Now: Can anyone explain why one approach works while the other one doesn't? The Fanuc books I have access to are "unclear" on this point.
Thanks!