Hi guys!,
I'm a former Motoman guy, trying to become a Kuka guy... So before you even ask, yes I know about the Cell program and how Kuka wants me to do it...
But I don't want to do it Kuka's way. LOL,
What I'm looking for is how to select a program from the plc while in external auto without the program starting to run. I want to select the program and verify it's on the correct line before pressing START.
The default SPS has : CWRITE($CMD,STAT,MODE,"RUN /R1/CELL()") ; code used by Kuka to start the cell.
I want to make it something like: CWRITE($CMD,STAT,MODE,"SELECT /R1/MASTER()") ;but I know Select isn't an option.
I have read the cread/cwrite manual but it doesn't get into enough detail to figure this out with my limited knowledge.
I have a couple of ways to do it, but looking for the cleanest, proper, etc. way to do it.
I'm told to try executing the command with motion enable off, not sure if this will alarm or just work,
I could put a HALT at the top of my program, but don't like that as it's too easy to forget to add or edit out later...
Here's a bit of my code for reference, the first fold is for TOP of Master job, this works great, and the second fold is CALL MASTER job. (Motoman terms...LOL)
my software version: KRC 5 Micro 8.7.4
;FOLD TOP OF MASTER
;SET OUTPUT FOR AT TOP OF MASTER PROGRAM
IF ($PRO_STATE1 <> #P_FREE) THEN ; If a program is selected
IF (StrComp($PRO_NAME1[],"MASTER",#NOT_CASE_SENS)==TRUE) THEN
IF $PROG_INFO[1].PRO_IP_SNR == 3 THEN ;PROGRAM LINE NUMBER
$OUT[14] = TRUE; AT TOP OF MASTER
ENDIF
ENDIF
ENDIF
IF ($PRO_STATE1 <> #P_FREE) THEN ; If a program is selected
IF (StrComp($PRO_NAME1[],"MASTER",#NOT_CASE_SENS)==TRUE) THEN
IF $PROG_INFO[1].PRO_IP_SNR <> 3 THEN ;PROGRAM LINE NUMBER
$OUT[14] = FALSE ;NOT AT TOP OF MASTER
ENDIF
ENDIF
ENDIF
IF ($PRO_STATE1 <> #P_FREE) THEN ; If a program is selected
IF (StrComp($PRO_NAME1[],"MASTER",#NOT_CASE_SENS)==FALSE) THEN
$OUT[14] = FALSE ;NOT AT TOP OF MASTER
ENDIF
ENDIF
IF ($PRO_STATE1 == #P_FREE) THEN ; If a program is NOT selected
$OUT[14] = FALSE ;NOT AT TOP OF MASTER
ENDIF
;ENDFOLD TOP OF MASTER
;FOLD MASTER PROGRAM CALL FROM PLC
IF $IN[14] == TRUE THEN
IF $MODE_OP == #EX THEN
IF ($PRO_STATE1 <> #P_FREE) THEN ; If a program is selected
IF (StrComp($PRO_NAME1[],"MASTER",#NOT_CASE_SENS)==FALSE) THEN
CWRITE($CMD,STAT,MODE,"STOP 1")
WAIT SEC 1
CWRITE($CMD,STAT,MODE,"CANCEL 1")
WAIT SEC 1
ENDIF
ENDIF
IF ($PRO_STATE1 == #P_FREE) THEN ; If a program is not selected
CWRITE($CMD,STAT,MODE,"SELECT /R1/MASTER()")
ENDIF
ENDIF
ENDIF
;ENDFOLD MASTER PROGRAM CALL FROM PLC
Thanks in advance for your help!