Hello everyone,
I have a problem on a cell that I am starting, I manage the KUKA krc2 as a slave from a PLC, I should send a bit when a specific program is selected.
I think I should enter this function in the SPS, but I do not know which variable I have to use.
Do you have any ideas?
I have already tried $PRO_NAME1[], but I don't understand how I can use it.
Thanks in advance.
Flag true when Main Program is selected
-
MrNico -
February 13, 2018 at 6:59 PM -
Thread is marked as Resolved.
-
-
$PRO_NAME1[] is a string variable that shows the name of the currently selected program in the robot interpreter. You can simply do a string comparison on it, although you may need to use VARSTATE or STRLEN to protect against conditions where the variable is empty (when a program has been cancelled, for example).
I don't believe $PRO_NAME1[] changes as the program pointer dives into subroutines, but I could be recalling incorrectly.
-
If I get you right, I would suggest that you create a variable inside each subprogram, set it as soon as the program is called and reset when exiting. Since PLC is the master, you can send this specific variable status to PLC in a similar way you make handshake signals between Robot-PLC .
-
I tried to make a comparison with strcomp, but it does not work.
Have you ever used strcomp?
If I try to read the variable $PRO_NAME1 [] I have this result "/R1/Lavorazioni.scr"
StrComp($PRO_NAME1[], “/R1/Lavorazioni.scr”, #NOT_CASE_SENS) but strcomp is always FALSE.
Have you an idea where I'm wrong? -
If I get you right, I would suggest that you create a variable inside each subprogram, set it as soon as the program is called and reset when exiting. Since PLC is the master, you can send this specific variable status to PLC in a similar way you make handshake signals between Robot-PLC .How can I reset the variable when the program is deselected?
-
Just set a Flag in each programm. Then link the Flag to Output in sps.sub to PLC.
-
[size=2]program selected and program running are two different things.[/size]
[size=2]is supposed to be part of interlock for robot start?[/size][size=2]if you need to know program running, then something like this may do:[/size]
[size=2]in $CONFIG.DAT[/size]
[size=2]in SPS.SUB loop add something like[/size]
And then at the begin of each program add line such as
-
No, I need to know if a specified program is selected for give the Move Enable from plc only with this program.
-
In Your post You wrote ".scr" think it should be ".src", or there may be another typo.
Try to work with "StrFind" and only a part of the program name. -
I tried to make a comparison with strcomp, but it does not work.
Have you ever used strcomp?
If I try to read the variable $PRO_NAME1 [] I have this result "/R1/Lavorazioni.scr"
StrComp($PRO_NAME1[], “/R1/Lavorazioni.scr”, #NOT_CASE_SENS) but strcomp is always FALSE.
Have you an idea where I'm wrong?When I test $PROG_NAME1[], I do not get the "R1/" portion or the file extension, only the program name.
You could probably try using STRFIND in place of STRCOMP. -
Yes, ok I solved my problem this is the results.
RicercaProgramma = StrFind(1,$PRO_NAME1[], "LAVORAZIONI", #NOT_CASE_SENS)
oProgLavorazione = RicercaProgramma == 1where oProgLavorazione is my output for the PLC
RicercaProgramma is an Integer declared in config.dat
LAVORAZIONI is the Program to checkObviously this is wrote in the SPS.
Thank you everyone and I hope this post can help somebody else.