KUKA Programming Notes
KUKA Programming Notes
Point-to-Point (PTP)..................................................................................................... 2
Positions in Cartesian Coordinates (POS)....................................................................3
EXT Function............................................................................................................... 4
Interrupt..................................................................................................................... 5
Declaring Interrupts................................................................................................ 5
Activating Interrupts................................................................................................ 5
Brake.......................................................................................................................... 7
Loops.......................................................................................................................... 8
FOR Loop................................................................................................................. 8
WHILE Loop............................................................................................................. 8
REPEAT Loop............................................................................................................ 8
ENDLESS / INFINITE Loop......................................................................................... 9
Continue................................................................................................................... 10
Logic Commands...................................................................................................... 11
Point-to-Point (PTP)
Reference: Expert programming, p.58
DEF PTP_AXIS() ;the name of the program is PTP_AXIS
$VEL_AXIS[1]=100 ;definition of the axis velocities
$VEL_AXIS[2]=100
$VEL_AXIS[3]=100
$VEL_AXIS[4]=100
$VEL_AXIS[5]=100
$VEL_AXIS[6]=100
$ACC_AXIS[1]=100 ;definition of the axis accelerations
$ACC_AXIS[2]=100
$ACC_AXIS[3]=100
$ACC_AXIS[4]=100
$ACC_AXIS[5]=100
$ACC_AXIS[6]=100
PTP {AXIS: A1 0,A2 -90,A3 90,A4 0,A5 0,A6 0}
END
Changing one axis only
PTP {A3 45}
Robot position its axis in absolute values
Using relative motion
PTP_REL {A1 35, A4, 35}
Robot moves in relative motion (note that it is difficult for the robot to get the
correct position if relative type of motion is used)
Modification of base:
$BASE = {X 100,Y -200,Z 1000,A 0, B 180,C 45)
Analgoues
EXT Function
Interrupt
Reference: Expert Programming, p.125
Declaring Interrupts
Description: Halts robot from current process, and resumes where it left off.
General Notes:
IR_STOPM.SRC = predefined emergency stop program
This is an instruction and not a declaration. Therefore it must not be included
in the declaration section
Interrupts in subprograms are not recognized. See GLOBAL INTERRUPT
Up to 32 interrupts may be declared
Interrupt:
INTERRUPT DECL <Priority No.> WHEN <Event> DO <Subprograms>
INTERRUPT DELC 4 WHEN $IN[3] == TRUE DO SP1()
Priority No.: 1 39, 81-128 (40-80 reserved)
1 highest priority
128 lowest priority
Event bool: bool constant, variable
Subprogram: to be executed when the event conditions are satisfied.
Global Interrupt:
GLOBAL INTERRUPT DECL <Priority> WHEN <Event> DO <Subprograms>
GLOBAL INTERRUPT DECL 4 WHEN $IN[3] DO SP(1)
Remains valid, even at different subprograms
Activating Interrupts
Switching on/off Interrupt
INTERRUPT ON <Priority No.>
INTERRUPT OFF <Priority No.>
INTERRUPT ON 4
INTERRUPT OFF 4
When interrupt is initially declared, it is switched off
Using a priority number switches on/off the corresponding priority
Switching on/off all interrupts
INTERRUPT ON
INTERRUPT OFF
Switches on all interrupts
Only 16 interrupts at a time can be switched on
Disable/enabling one/all interrupts
DISABLE 4
ENABLE 4
DISABLE
ENABLE
Protects certain sections of the program before being interrupted
Brake
Reference: Expert Programming, p.131
Description: Stops robot from current motion in the event of an interrupt
General Notes:
Can only be used in an interrupt, otherwise it would result in an error.
BRAKE
BRAKE F
BRAKE F = shorter braking distance
Robot will continue where it left off in the interrupted program
Loops
Reference: Expert programming, p. 95
FOR Loop
FOR <Counter> = <Start> TO <End> STEP <Increment>
INSTRUCTIONS
ENDFOR
FOR I = 1 TO 6 ; STEP = 1 by default
$VEL_AXIS[I] = 100
ENDFOR
FOR I=1 TO 9 STEP 2
FOR J=6 TO 1 STEP -1
ARRAY[I,J] = I*2 + J*J
ARRAY[I+1,J] = I*2 + I*J
ENDFOR
ENDFOR
WHILE Loop
Runs only of the condition is fulfilled
WHILE <Execution Condition>
INSTRUCTIONS
ENDWHILE
WHILE $IN[$] == TRUE
PTP PALLET
$OUT[2] = TRUE
PTP POS_2
$OUT[2] = FALSE
PTP HOME
ENDWHILE
REPEAT Loop
Continue
Expert programming, p. 81
Logic Commands
AND, OR, NOT
Wait
Expert programming, p. 99
WAIT For
Stops program execution until the event specified by the condition arises
WAIT FOR <Condition>
WAIT FOR $IN[5] ; wait until input output 5 is true
WAIT FOR $OUT[5] == FALSE ; wait until input output 5 is false
Can also be applied to
$IN[], $OUT[], $CYCFLAG[], $TIMER_FLAG[], $FLAG[]
WAIT SEC
WAIT SEC <time>
WAIT SEC 17.542
; seconds
Trigger
Expert programming p.135
TRIGGER WHEN DISTANCE = <Switching point> DELAY = Time DO Instruction
<PRIO=Priority>