603,968 active members*
2,894 visitors online*
Register for free
Login
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2007
    Posts
    40

    21i Macro Question

    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

  2. #2
    Join Date
    Mar 2003
    Posts
    2932
    Maybe this would work:

    O9020;
    #101=#20
    M06;
    POPEN;
    DPRNT[T#101[20]];
    PCLOS;
    M99;

  3. #3
    Join Date
    Nov 2007
    Posts
    40
    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

  4. #4
    Join Date
    Nov 2007
    Posts
    40
    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!

Similar Threads

  1. custom macro question
    By sinha_nsit in forum G-Code Programing
    Replies: 28
    Last Post: 04-18-2009, 12:44 PM
  2. Macro B Question
    By Bluetech in forum Fanuc
    Replies: 7
    Last Post: 03-10-2009, 06:58 AM
  3. Convert Fanuc Macro to Fadal Macro
    By bfoster59 in forum Fadal
    Replies: 1
    Last Post: 11-09-2007, 06:41 AM
  4. Noob Drill Grid Pattern Macro Question
    By KOzOK in forum Fadal
    Replies: 8
    Last Post: 01-08-2007, 04:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •