January 17, 2019, 07:56:18 PM
Robotforum | Industrial Robots Community

 Flag true when Main Program is selected


Author Topic:  Flag true when Main Program is selected  (Read 1152 times)

0 Members and 1 Guest are viewing this topic.

February 13, 2018, 05:59:35 PM
Read 1152 times
Offline

MrNico


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.

Linkback: https://www.robot-forum.com/robotforum/index.php?topic=25838.0
« Last Edit: February 13, 2018, 06:07:08 PM by MrNico »
  • Like    Thanks

Today at 07:56:18 PM
Reply #1

Advertisement

Guest

February 13, 2018, 06:21:45 PM
Reply #1
Offline

SkyeFire

Global Moderator
$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.
  • Like    Thanks

February 13, 2018, 06:43:38 PM
Reply #2
Online

davidina


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 .
  • Like    Thanks

February 13, 2018, 06:55:03 PM
Reply #3
Offline

MrNico


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?
  • Like    Thanks

February 13, 2018, 06:57:35 PM
Reply #4
Offline

MrNico



How can I reset the variable when the program is deselected?
  • Like    Thanks

February 14, 2018, 12:19:17 AM
Reply #5
Offline

spiral


Just set a Flag in each programm. Then link the Flag to Output in sps.sub to PLC.
  • Like    Thanks

February 14, 2018, 02:32:26 AM
Reply #6
Offline

panic mode

Global Moderator
program selected and program running are two different things.
is supposed to be part of interlock for robot start?

if you need to know program running, then something like this may do:

in $CONFIG.DAT
Code: [Select]
SIGNAL PROGRAM_RUNS $OUT[1] TO $OUT[32]

in SPS.SUB loop add something like
Code: [Select]
IF $PRO_STATE1==#P_FREE THEN
  PROGRAM_RUNS=0
ENDIF



And then at the begin of each program add line such as


Code: [Select]
PROGRAM_RUNS=1 ; use different value in each program
; if you want individual bit to indicate running program, just make sure
;to only use values that are binary powers (1,2,4,8,16,32...)



  • Like    Thanks
1) http://www.robot-forum.com/robotforum/kuka-robot-forum/read-first/
2) if you want reply about robot, post it in forum
3) read 1 and 2

Today at 07:56:18 PM
Reply #7

Advertisement

Guest

February 14, 2018, 05:47:27 AM
Reply #7
Offline

MrNico


No, I need to know if a specified program is selected for give the Move Enable from plc only with this program.
  • Like    Thanks

February 14, 2018, 07:34:07 AM
Reply #8
Offline

hermann


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.
  • Like    Thanks

February 14, 2018, 04:06:18 PM
Reply #9
Offline

SkyeFire

Global Moderator
 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.
  • Like    Thanks

February 14, 2018, 04:42:51 PM
Reply #10
Offline

MrNico


Yes, ok I solved my problem this is the results.

RicercaProgramma = StrFind(1,$PRO_NAME1[], "LAVORAZIONI", #NOT_CASE_SENS)
oProgLavorazione = RicercaProgramma == 1

where      oProgLavorazione  is my output for the PLC
               RicercaProgramma is an Integer declared in config.dat
               LAVORAZIONI is the Program to check

Obviously this is wrote in the SPS.
Thank you everyone and I hope this post can help somebody else.   :dance2:  :toothy9:
« Last Edit: February 14, 2018, 04:46:15 PM by MrNico »
  • Like    Thanks


Share via facebook Share via linkedin Share via pinterest Share via reddit Share via twitter

xx
Syst-019 program not selected

Started by nataninstag on Fanuc Robot Forum

0 Replies
1551 Views
Last post November 26, 2015, 07:10:33 PM
by nataninstag
xx
Changing values while robot program is selected

Started by Plc_User on KUKA Robot Forum

2 Replies
1217 Views
Last post March 12, 2016, 12:19:34 AM
by SkyeFire
xx
Lost flag in program

Started by 9566317 on KUKA Robot Forum

7 Replies
2887 Views
Last post January 30, 2014, 12:39:38 AM
by 9566317
question
memory, flag, cyclic flag

Started by knowledgesharing on KUKA Robot Forum

6 Replies
4873 Views
Last post December 23, 2013, 05:05:23 PM
by SkyeFire