Thank you Panic Mode and SkyeFire!
Sorry I did not construct my post clearly. The Robot is master to it. Though the robot is also slave to the PLC. I only used that module for gripper activities on the robot.
I finally found a way out. For those who may find it useful later, this is what I did. I wrote a separate .sub program and called it in the sps.sub.
Code
DEF StopMessage()
;; ===================================================
;; Stopmessage
;;
;; Forward $Stopmess - message number to Robot PLC/HMI
;; ===================================================
IF $STOPMESS THEN
IF (mbx_rec($stopmb_id,mld) == 0) THEN
zStopmessPointer = mld.messno
IF zStopmessPointer <= 4096 THEN
bStopmessState[zStopmessPointer] = (mld.state == 1)
ENDIF
zStopmessPointer = 0
ENDIF
bResetStopmess=TRUE
ELSE
IF bResetStopmess THEN
; reset messages
bResetStopmess = FALSE
FOR zStopmessPointer = 1 TO 4096
bStopmessState[zStopmessPointer] = FALSE
ENDFOR
ENDIF
ENDIF
END
Display More
I fetch the KSS message/error number out of the array that was declared in a separate .dat file and this is used to send signals to the PLC
Code
DEFDAT StopMessage PUBLIC
BOOL bResetStopmess
INT zStopmessPointer
DECL STOPMESS MLD
GLOBAL BOOL bStopmessState[4096]
ENDDAT
Thank you!