I'd (once again) need the swarm intelligence of the forum to solve a problem.
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.
Any fancy idea out there?