How to "BGL wants program to JMP LBL"?

  • I'd (once again) need the swarm intelligence of the forum to solve a problem. :upside_down_face:


    The FANUC is in an assembly program and is assembling a component. At the end of the program there is a handshake with the PLC. The handshake will write the content of R[190] to a GO and report "job finished". R[190] may contain an InfoCodeNo (stuff like errorNo, notificationNo, ... ) or 0 if everything was ok.


    1: !job 20: assembly program

    ...

    20: !fetch the data ;

    21: CALL _GET_JOB_DAT ;

    22: ;

    23: IF (R[190:InfocodeNo]<>0) THEN ;

    --: !_GET_JOB_DAT wrote something to R[190] -> error in data;

    24: JMP LBL[9999] ;

    25: ELSE ;

    --: !acknowledge data ok;

    28: GO[5:JobACK]=R[151:JobNo]+2 ;

    29: ENDIF ;

    ...

    (move to assembly position)

    ...

    305: !release part (open gripper) ;

    306: CALL _RELEASE(0,2,1) ;

    307: ;

    308: IF (R[10:GL Port 0]<>3) THEN ;

    ---: !gripper is not RELEASED;

    310: R[190:InfocodeNo]=4000+R[10:GL Port 0] ;

    311: JMP LBL[9999] ;

    312: ELSE ;

    313: GO[8:PartDropped]=1 ;

    315: ENDIF ;

    ...

    (moves home)

    ...

    347: LBL[9999] ;

    348: !job finished ;

    350: CALL _HANDSHAKE(R[151:JobNo]) ;


    The status of the gripper is read cyclically in a BG logic program. If it changes from holding to no part while on the way from pick to mount the part was lost. The movement of the FANUC should then pause and the assembly program should jump to LBL[9999] (line 347) and call the handshake. In the BGL I'd write the according InfoCodeNo to R[190], but how can I get the assembly program to jump to LBL[9999] WITHOUT inserting an IF (R[190:InfocodeNo]<>0), JMP LBL[9999] before each move command? As far as I have seen I cannot use CALL in BGL to call any other program - like the handshake. :unamused_face:


    Any fancy idea out there? :thinking_face:

    Never EVER again fanuc!

  • The SkipJmp command might be what you want, or the Skip if you have a newer OS version:

    Code
      !Set Recovery Skip Input ;
      SKIP CONDITION DI[521:diMHRecoveryReq]=ON    ;
      !Monitor for Skip Jump Cond ;
      !In front of Drop Position ;
      L PR[111:Cart 2 Drop] 2000mm/sec CNT10 SkipJump,LBL[999] 
  • The SkipJmp command might be what you want, or the Skip if you have a newer OS version:

    The Skip would block the one possible Additional Motion Instruction and I would hate to use it this way because I'm pretty sure I'll need them later on in the project for handling some of the pick and place situations. Additionally it would need all the motions in this job to be altered / changed / modified (1). But in general you are definitely true.


    You can use the RUN instruction in background logic to asynchronously execute the _HANDSHAKE program. Just need to be careful of timing.

    I can already feel my heart rate rising when I think about having to program something like this with this unwieldy and cumbersome FANUC. :grinning_face_with_smiling_eyes:
    Seriously spoken: This would be pretty tricky to solve because not only the PLC will be the receiver but also a Production Management System.



    (1) Wie sagt man das im Englischen richtig: "Ich müsste alle Bewegungsbefehle anpassen"?

    Never EVER again fanuc!

  • There are only a few ways to interrupt motion and then take an action. SkyeFire mentioned skip or SkipJump, which would be the typical way. Another option would be a condition monitor, but that doesn't allow you to directly resume motion which could get complicated. A third option is to use the PLC and UOP to help.


    The PLC could monitor your signal and then abort the robot when needed. It could them send the Prod Start signal to start the robot over again. But also send an additional signal or register in this case so the robot can call a different routine that handles the state your robot was in. If you structure the PLC and robot program correctly it will achieve the same thing without needing to add Skip to every motion.

  • ... Another option would be a condition monitor, but that doesn't allow you to directly resume motion which could get complicated. A third option is to use the PLC and UOP to help.


    ... If you structure the PLC and robot program correctly it will achieve the same thing without needing to add Skip to every motion.


    Canceling somewhere in the middle of the job and restarting the FANUC already works. This actually uses the UOP signals to start the program right from the beginning. When restarting, the FANUC moves to HOME and throws any part on the gripper into an NOK-box.


    When the part is lost I would like the FANUC to stop so the worker can have a closer look for the reason why the part has been lost. Additionally I would like to send a report to the PLC / PMS using the handshake (it's a separate program). The current Job will be canceled and needs to be restarted anyway.


    The Condition Monitor looks like it can do the job. As a first step I'll try this. Thanks a lot! :thumbs_up:


    If this doesn't help we will take the detour via the PLC, because the status of the gripper is already transmitted to the PLC in real time.

    Never EVER again fanuc!

Advertising from our partners