Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 11

What are Non-Motion Instructions?

In our programs so far, we have only created sequences of motion instructions that will run through
without deviation. They aren’t adaptive and they aren’t very efficient.

It is important to remember that our robot is a computer and everything it does is based on data
Non-Motion Instructions running through a processor. Processors work based on math instructions. The memory space that
Registers, IF statements, Jumps, stores math variables and results are known as Registers. We can work with this data to change
motion variables, changing what the robot does depending on data results.
OFFSET, PR[]
Industrial Robotics & Automation Registers hold data that can be referenced in programs. On the FANUC controllers, registers hold
Written by Michael Eagan whole and decimal real numbers, positive and negative.
SUNY Erie Community College Position Registers differ in that they hold six separate numerical values, called “Elements”. This is
designed for holding the six possible cartesian coordinate values – X,Y,Z, Yaw, Pitch, and Roll.

*While we will not be exploring Joint in this lab, the position registers can also hold degree values
for the Joint coordinate system.

Register instructions perform math operations on normal registers and position register elements such
as addition, subtraction, division, multiplication, and setting them equal.

Conditional Statements are instructions that can do two separate actions, depending on if a math
equation happens to be true.

Registers:

Register Type Details

Prerequisite Knowledge:
Safety Register A single numerical value.
Teach Pendant Navigation
Jogging and Clearing Alarms
Motion Instructions
Running Programs Position 6 separate numerical values, mostly used to store positional
Required Preliminary Setup: Register data.
Laser ON
A Free Register set to 0
Robot at HOME Position Example:
PR[4] zeroed out.

Instruction Description
LBL[1] This is a label. We put down this instruction to label it as a point we
wish to “jump” to later.
R[5] = 1 R[5] will now contain the numerical value 1.

R[5] = R[5] + 1 R[5] is equal to itself (1) plus the constant of 1. Result is 2.

PR[4,1] = 23 The first element of PR[4] is now equal to 23. This is the X value.

The math equation “R[5] > 1” is checked to see if it is true.


IF R[5] > 1 JMP Since R[5] is indeed greater than 1, it will jump to LBL[1:Start].
LBL[1:Start] If it wasn’t true, the program would continue to the next line as if
nothing happened.
This instruction is only reached if R[5] isn’t greater than 1. If it is
JMP LBL[2] reached, the processor will jump to LBL[2], somewhere else in the
program.

This guide is intended to demonstrate and explain Registers, Jumps, Labels, IF statements, OFFSETs, and Loops on FANUC controllers.
All labs assume HandlingTool software.
Start by hitting the DATA key on the teach pendant’s keypad. This will open the
DATA page.

The DATA page will open on whatever type was last viewed. We want to get to the
Registers page but it may not yet be selected.

In the example to the left, we are viewing the “Pallet Registers” page. To change to
Registers, select the softkey [TYPE] and choose the first option, “Registers”.

Now we will be on the Registers page in the DATA screen. This page lets us view
the registers available for use on the teach pendant, as well as their contents.

Notice a couple of them have already been used and commented with various
names, such as counter or offset.

*By default there are 200 registers available for use, but this can be expanded through
advanced changes to variables outside the scope of this lab.

Choose any register on the first page other than R[9] and hit the ENTER key on the
teach pendant’s keypad. This will prompt you to comment the register with a name.
Using the keyboard as you have done before, name the register COUNTER.

REMEMBER which register number you chose. Any time you see a register used
in this lab, replace it with the number you have chosen.
Registers can be used without commenting them, but it is just easier to program
when they have useful names.

We can also manually enter values into the register.

With your register selected, hit the RIGHT arrow key to move the cursor to the
register’s value.

Type the number 9 on the keypad and then ENTER to confirm entry.

Your register now contains a value of 9.

*Data registers can contain values up to 10 to the power of 17, which comes out to be
around 10 quadrillion.

Cursor to your register’s contents once again. This time type -1 and hit ENTER.

*Registers can contain both positive and negative values.

We’re going to leave our register at -1 for the time being.

Attached to the end of this lab is a template for a simple motion program you
should create. Detach and tape it to the box on the bed. Ensure the box is within the
safety zone.

For reference on how to create programs, look back to your “Motion Instructions” lab.

Name your program with the following syntax:

Semester Underscore MProg Underscore Your Initials


F19 _ MProg _

Add motion to your program that starts at home, reaches every point on the
template sheet, and ends at home. To change from a position to a position register,
cursor to P[1] and hit softkey CHOICE.

The program should look as follows:

J PR[1:HOME] 100% FINE

J P[1] 100% FINE

L P[2] 225mm/s FINE

L P[3] 225mm/s FINE

L P[4] 225mm/s FINE

L P[1] 225mm/s FINE

J PR[1:HOME] 100% FINE


Now we want to leave this program alone and make a copy of it for the next part of
the lab.

Hit the SELECT button to get to the SELECT screen, showing all available
programs.

Highlight the program you just created. Hit the NEXT button to cycle the softkeys
right, showing the COPY function.

Hit the COPY softkey. You will be prompted to name the new copied file. Name it
with the following syntax:

Semester Underscore RProg Underscore Your Initials


F19 _ RProg _ MRE

When prompted with “Copy OK?” hit YES.

You will be returned to the SELECT screen. Find the newly copied program and
cursor to it.

Hit ENTER to open the editor for the new program.

This is an exact copy of the original motion program, and any changes we make to
it won’t affect the original.

The first thing we want to do is make this program loop. We’ll be using registers
next to count the loops, and then add conditional instructions after that to stop after
a certain number of loops through the program.

Cycle right on the softkeys with the NEXT button. This reveals our non-motion
instruction key, [INST] and our general editing key EDCMD.

Scroll to the bottom of your program and cursor to the line that contains the Joint
move to HOME. We don’t want this home instruction inside our loop, so we’ll add
a blank line above it.

To insert a blank line, hit the EDCMD softkey and hit INSERT. You will be
prompted about how many lines you wish to add, but we only need one for now.
Hit enter and a blank line will be added above the selected line.
Inside that blank line, we want to add a JMP LBL[] instruction. To do so, hit the
[INST] softkey and hit JMP/LBL. Then you choose “JMP LBL[]” and it will
place that instruction into your blank line.

You will need to tell it which label specifically to use. We will use LBL[1]. Type 1
and hit enter.

When this instruction is reached, it will jump to whatever line LBL[1] is on. We
haven’t put LBL[1] on any lines yet, so it won’t work. We’ll do that next.

Repeat the same process of adding a blank line and the non-motion instruction to
place a LBL[] between the home instruction and our first point on line 2. Make sure
to choose the LBL[] instruction instead of JMP LBL []. When prompted, enter the
value of 1 and hit ENTER.

*Labels are treated as blank lines to the processor when reached. They don’t do anything
unless something else jumps to them, such as our JMP LBL[1] instruction

Cursor to the first line of your program, clear all alarms, make sure the Step
indicator at the top left is green, then hold SHIFT and press FWD.

Your robot should go home, then begin tracing your square. Notice the last
instruction, a Joint move to HOME, is never reached, and the first instruction to
HOME isn’t happening again. These instructions are outside our loop, so the
processor never sees them.

This is an unconditional loop. It will just continue forever, until you stop the
program, or something errors out.

Next, we will make it conditional.


Cursor to that JMP LBL[1] line toward the end of your program.

Normally when we add instructions, we need to insert a blank line first to prevent
overwriting of existing lines. In this instance, we do want to overwrite the JMP
LBL [1] so no blank line is necessary.

Add a new instruction with [INST], this time selecting IF/SELECT.

It will give you a list of possible relational operators. For this we want the less
than symbol, <

Choose it.

Next it will prompt you for the first variable to compare. We’ll be using your
register for this, so choose R[ ]. It will prompt you for the register number. Type
the number of the register you chose earlier and hit ENTER.

Next is the rightmost variable. This is what the IF statement is checking to see if
your register is less than.

This will be the count of how many times you wish it to loop before stopping,
which is a constant number.

Hit CONSTANT, and then type 3 on the keypad. Hit ENTER.

Next it will prompt you for what action to take. Choose JMP LBL [] and enter the
value of 1 in the label. Remember to hit enter after typing 1.

This will cause it to loop so long as your register is less than 3.

Now if we ran this program, it would be the same as before. Since your register
contained -1, and -1 is certainly less than 3, it will loop. Nothing in the program
changes what is in register 3, so it will again loop forever.

We need to add a register instruction to increment the register by 1 each time


through the loop.

This incrementing needs to be inside the loop to happen, so put it right before the
IF statement. Remember to insert a blank line first.

The register instruction is in [INST] under register.

You will make it equal to itself, plus the constant of one.

R[9] = R[9] + 1
Now each time through the loop, your register’s value will go up by one.
Eventually it will no longer be less than 3, and the program will no longer loop,
simply ending with that last Joint move to HOME.

If you ran it now from the beginning (feel free to do so) it will run more than 3
times. This is because the register started at -1. Our program requires it to start at
zero.

Additionally, if you ran the program a second time, it wouldn’t loop at all. The first
run left the register at 3, and nothing told it to go back to zero.

Let’s add that instruction at the beginning to “set up” our register.

R[9] = 0

As yet another reminder, you are not using R[9]. You are using the register you
chose earlier.

Since anything outside the loop only runs once, it will only set it equal to zero once
when you first run your program.

This tidies up the variables so no matter what is in the register before you run the
program, it will be a consistent, predictable value when you do.

Go ahead and run your program through from the beginning. It should run 3 times
and then go home. STEP through the program to see what is happening too. You
can switch to dual-view to watch it happen in real time by hitting the top right icon
(far right on the blue bar), selecting the screen that isn’t your program, and hitting
DATA.

Congratulations, you’ve created a counted loop program!

Take the robot back to HOME position, turn the teach pendant off, press in
both emergency-stop buttons, and hang up your teach pendant. We will have a
quick lecture on adding OFFSETS before continuing to the next page.
PART 2 – DO NOT COMPLETE UNTIL AFTER OFFSETS LECTURE

So far, the robot has only ever moved to the points we have directly taught it to go.
We’re going to make it more adaptive, being able to go to a changing offset of the
points taught.

Start by selecting the blank space to the right of one of the square’s motion lines.
Notice the on-screen option [CHOICE]. Choose it and it will open the motion
modify list of choices.

Choose the OFFSET, PR[ ] option. This is the modifier we will use to adjust our
program between loops. Your next option will be to choose whatever position
register you want to store that offset data. For this lab, we will use PR[4] since you
set all 6 elements to zero in the data types lab.

Add the same motion modifier to all the motion lines that deal with the square.
Don’t add them to our PR[1:Home] lines because we have no need to offset the
home location.

As you now know, the individual elements of the original motion’s position will be
added to the individual elements of the position register chosen, and the result is the
actual destination the line will reach.
If you ran the program as it is currently, nothing will be different from our original
registers-only version. The offsets will be applied, but the position register contains
only zeros in each element, so the destination coordinates won’t be any different.

We want it to change the contents each time it loops through the program,
completing the square slightly higher each time. Do this by adding a register
addition instruction above the IF statement.

We only want to use the third element, which is Z. To work with a single element,
think back to the register lab. PR[i,j] lets you choose your position register number
(i) and the individual element (j).

Your register instruction should make the third element of PR[4] equal to
itself plus 25. *Don’t forget to insert a blank line, or you will overwrite whatever
line is selected!

Just like with register 9, we need to make sure it starts at zero every time the
program begins. If we didn’t, each run of the program would continue adding more
to that element, and eventually the offset would force it to the edge of the DCS
zone.

Under the register 9 zeroing instruction at the top, add a register instruction
at the top to make the 3rd element of PR[4] equal to 0.

*Don’t forget to insert a blank line, or you will overwrite whatever line is selected!

Run your program from the beginning, stepping through it for at least one
loop before making it continuous.

Notice each time the robot completes the circle; it will do so slightly higher than
the previous loop.

You can run the program while viewing the position register 4 detail page, and
watch it increase as well.

This is intended to introduce offsets. We can reach dozens of points with only a
handful of motion instructions and actual taught points.

This can be applied everywhere, from palletizing and sorting, to picking and
placing integrated circuits.

In the next lab, we will use them to pick and place 25 pepperoni pieces, with only 4
motion instructions!

You might also like