So I'm certain this is super simple for you guys, yet I'm struggling to create a basic subroutine that sets an output on its way IN to it. An argument is what I'm used to calling it (I'm good with ABB/Motoman/Fanuc and VERY new to Kuka). I've read through the examples in the "KUKA System Software 8.7 - Operating and Programming Instructions for System Integrators" manual, yet still can't figure it out. This is a new KRC5 KSS 8.7.6
Basically I want this:
DEF Stud_Routine( )
PTP P1 Vel=100 % PDAT1 Tool[1]:Screw_Gun Base[0]
;STUD 1
LIN P2 Vel=1 m/s CPDAT5 Tool[1]:Screw_Gun Base[0]
Start_Stud (1)
LIN P1 Vel=2 m/s CPDAT2 Tool[1]:Screw_Gun Base[0]
LIN P3 Vel=2 m/s CPDAT2 Tool[1]:Screw_Gun Base[0]
;STUD 2
LIN P4 Vel=2 m/s CPDAT2 Tool[1]:Screw_Gun Base[0]
Start_Stud (2)
LIN P5 CONT Vel=2 m/s CPDAT2 Tool[1]:Screw_Gun Base[0]
END
So within the Start_Stud subroutine or function (unsure which I need to use for this) If that argument in Start_Stud is set to 1 it sets $OUT[50]=TRUE and if it's set to a 2 it sets $OUT[51]=TRUE
After that I can make some decisions and error handling/fault recovery with the PLC which is actually controlling the gun from there. Just trying to make the main program a little more neat with a function.
Thanks