0% found this document useful (0 votes)
12 views35 pages

L10 - Branching and PR

The document outlines the objectives and instructions for performing various types of branching in robotics programming, including unconditional and conditional branching, as well as the use of data registers. It explains how to implement loops and select instructions, along with the use of wait instructions to control program execution. Additionally, it covers position register instructions, offsets, and miscellaneous instructions for enhancing program functionality.

Uploaded by

shiv.omyt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views35 pages

L10 - Branching and PR

The document outlines the objectives and instructions for performing various types of branching in robotics programming, including unconditional and conditional branching, as well as the use of data registers. It explains how to implement loops and select instructions, along with the use of wait instructions to control program execution. Additionally, it covers position register instructions, offsets, and miscellaneous instructions for enhancing program functionality.

Uploaded by

shiv.omyt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

CADM MC600

Robotics

Branching

1
2
objectives

Preform Unconditional Branching Instructions


Use Data Registers
Preform Conditional Branching
Apply IF and SELECT Instructions
WAIT Instructions
3
Program instructions

Next > F1 [INST]

Note: [INST] is a softkey that allows access to more than motion


program instructions but other instructions for the Teach Pendant.
4
Tp program branching
instructions
Unconditional Branching
 LBL
 JMP LBL
 CALL
Conditional Branching
 Boolean Expression
 Integer Expression

 Option controlled by I/O signal or integer


5
LBL
6
JMP LBL
7
Call instruction
CALL program
– Instruction to send program flow out to a sub-
program
– When the called program finishes executing, it
returns to the main program at the first instruction
after the call program instruction.
CALL program example:
MAIN:
1. LBL[1]
2. CALL PROG_A
3. CALL PROG_B
4. CALL PROG_C
5. JMP LBL[1]
END
8
Data registers
Data Registers are used to store numbers to track part
counts, speed values, cycle counts, etc. The values
within the register can be changed within the program
using various arithmetic operations or group I/O.

Many instructions employ direct or indirect


addressing techniques. When direct addressing is
used, the actual value is entered into the instruction.
For example, if the register instruction R[3]=2 is
used, the current contents of register 3 is replaced
with the value 2.
Now consider the indirect address instruction of R[R3]]=5. When
indirect addressing is used, the instruction contains a register
within a register. This indicates that the actual value of the
internal register becomes the register number of the external
register. In the example shown above, Register 3 is the internal
register and statement shown (R[R[3]]) is the external register.
Since in the previous paragraph, the value of register 3 is 2, the
external register number addresses register 2 rather than register
3, Therefore, the result of the second instruction is that the
content of the external register 2 is replaces with the value 5.
(R[R[3]]=5 == R[2]=5)

The number of registers can be increased during a controlled


start. A maximum of 999 registers can be defined on a R-30iB
controller.

9
10
Register instructions

Arithmetic Registers used to store n umbers


Numbers can be used for arithmetic
operations, track part count, cycle count
May contain group I/O data
Default number of registers is 200
– Can be changed during initial setup or during
controlled start
11
Data registers
• Data Registers can be used for indirect addressing. This
method allows one program to be able to be able to run
multiple style parts, multiple positions (i.e.; machines) and
various other components within the program.
• In the above example line 7 will move to PR[5]
at 1500 mm/sec
• This allows such things as a PLC the ability to dictate
what the robot will do
12
Data registers contd.
• Registers can also be modified within a program as
well as shown in the example below

INDIRECT
DIRECT R[R[3]] = 13
R[3] = 8 R[8] = 13

Indirect addressing is
looking in R[3] to find
the number of the
register to put the
value of 13 into
13
Register instructions
14
limitations
You can mix “+” and “-” in the same instruction. Arithmetic
operations within an instruction that mixes “+” and “-” will
be performed from left to right. You cannot mix “*” or “/”
in an instruction that already contains “+” or “-”.
You can mix “*” and “/” in the same instruction. Arithmetic
operations within an instruction that mixes “*” and “/” will
be performed from left to right. You cannot mix “+” or “-”
in an instruction that already contains “*” or “/”.
The maximum number of arithmetic operations you can have
in the same instruction is 5.
Programs do not read the lines of the instructions again unless
instructed to do so (looped).
15
Register if instructions
16
If i/o instructions
17
Looping a program
• The FOR…DO loop creates a loop that repeats a
series of program instructions for a specified
number of times.
Example: FOR..DO loop program counting up

1. R[1] = 5
2. R[2] = 0
3. LBL [1] This program would
4. J P[1] 100% FINE
5. J P[2] 100% FINE
repeat 5 times then END
6. J P[3] 100% FINE
7. J P[4] 100% FINE
8. R[2] = R[2] + 1
9. IF R[2] >= R[1] JMP LBL [2]
10.JMP LBL [1]
11.LBL [2]
END
18
Looping a program contd.
• The FOR…DO loop creates a loop that repeats a
series of program instructions for a specified number
of times.
Example: FOR..DO loop program counting down

1.R[1] = 5
2.LBL [1]
3.J P[1] 100% FINE This program would
4.J P[2] 100% FINE repeat 5 times then END
5.J P[3] 100% FINE
6.J P[4] 100% FINE
7.R[1] = R[1] - 1
8.IF R[1] =< 0 JMP LBL [2]
9.JMP LBL [1]
10.LBL [2]
END
19
Looping a program contd.
• The WHILE loop creates a loop that executes
until a specific condition is or is not satisfied.

Example: WHILE loop program

1.LBL [1]
2.IF DI [1] = OFF JMP LBL[2] This program would
3.J P[1] 100% FINE execute until DI [1] (digital input 1)
4.J P[2] 100% FINE is OFF then END
5.J P[3] 100% FINE
6.J P[4] 100% FINE
7.JMP LBL [1]
8.LBL [2]
END
20
Looping a program contd.
• The REPEAT loop executes as long as the
condition is satisfied.
Example: REPEAT loop
program

1.LBL [1]
2.J P[1] 100% FINE
This program would
3.J P[2] 100% FINE
execute until DI [10]
4.J P[3] 100% FINE
(digital input 10)
5.J P[4] 100% FINE
is ON then END
6.IF DI [10] = ON JMP LBL[2]
7.JMP LBL [1]
8.LBL [2]
END
21
Select instructions

A select instruction compares the value of a register with one of


several values and takes an action if the comparison is true:
•If the value of the register equals one of the values, the jump or
call instruction associated with that value is executed.
•If the value of the register does not equal one of the values, the
jump or call instruction associated with the word ELSE is
executed.
22
Select program structure

If the value of the register equals one of the values, the jump or call
instruction associated with that value is executed.
If the value of the register does not equal one of the values, the jump or
call instruction associated with the word ELSE is executed.
23

Wait instructions

Delays program execution until specified


conditions are true or until amount of
time elapses
Timeout
Time interval
Input/Output
24
Wait instructions contd.
25
Wait instructions contd.
For WAIT instructions, logical instruction editing can contain
multiple logical expressions connected by AND or OR , AND
operator
– WAIT [cond1] AND [cond2] AND….
– Ex;1: WAIT DI [1] = ON AND DI [2] = ON, TIMEOUT, LBL [1]
• OR instruction
– WAIT [cond1] OR [cond2] OR…
– Ex;1: IF DI [10] = ON OR R [7] = R [8], JMP LBL [2]

WAIT [cond1] OR [cond2] OR [cond3] OR [cond4] OR [cond5]


MAX of 5 LOGICAL CONDITIONS
[Specify the timeout by setting the system variable $WAITTIMOUT to a
time, in t100th of a second. The default timeout vale is 3000 hundredths of a
second which is 30 seconds. You can set $WAITIMOUT using the
parameter name instruction. – Page 250]
CADM MC600
Robotics

Instructions
position registers &
miscellaneous

26
27

objectives
Use of Position Register Instructions
and apply positional register
statement

Apply OFFSET, PR[i,j] Element

Use Miscellaneous Instructions in a


program
28
Program instructions

Next > F1 [ INST ]


29

Register statement

Register statement
…=…
30
Position register instructions
PR[GRPn:x]=[value]

(1-8)

X,Y,Z,W,P,R X,Y,Z,W,P,R

(1-200)
31
Position register element
PR [i, j]
Indirect:
Direct:
Position register element #= contents of R[x]
Position Register element #

Direct:
Position Register element #
Indirect:
For Cartesian Positions: For Joint positions
Position register #= contents of R[x]
1=x 1=joint 1
2=y 2=joint 2
3=z 3=joint 3
4=w 4=joint 4
5=p 5=joint 5
6=r 6=joint 6

/PROG PREG_ELE
1: !POSITION REG VALUE
2:J P[1:ABOVE JOINT] 100% FINE
3:J P[2] 100% FINE
4: PR[1]=LPOS
5: PR[1,2]=600
6:L PR[1] 100.0inch/min FINE
7:J P[1:ABOVE JOINT] 100% FINE x, y, z, w, p, r,
/END
x, 600 ,z, w, p, r,
32
Position register element: example
Current Robot Position (LPOS) Move Up-Safe Z Height HOME Position

1: PR[10:SNAPSHOT]=LPOS
2: R[8:VALUE HOLDER]=
: PR[10,3:SNAPSHOT]
3: IF R[8:VALUE HOLDER]>100,
: JMP LBL[2]
4: PR[10,3SNAPSHOT]=100
5: J PR[10:SNAPSHOT] 100% FINE
6: LBL[2]
7: J PR[1:HOME] 100% FINE
33
offsets
Offsets are commonly used in Vision and Palletizing Applications
– An input or register can set the value
– Some Mathematical operations are possible
– Representation of the Point and Position Register should match …
(Cartesian or JOINT)

Offset Instructions:
OFFSET CONDITION PR[…]
OFFSET

OFFSET PR[…]

(You can manipulate a


component of a PR[…] by using
PR(i,j)

Example of Offset PR(i,j)


34

Register statement

Register statement
…=…+…
35
Miscellaneous instructions
• Timers- Used to track time of a routine or function.
• Override- Sets the % value of the programmed speed
• Remark- Allows a comment to be added to the program.
• Message- Displays the message on the user screen.
– USERCLR macro will clear it when used as a program
instruction.

You might also like