Programs: Difference between revisions

From Industrial Robotics & Automation - Fanuc Teach Pendant Programming
Content added Content deleted
Line 3: Line 3:


==== Setup Section ====
==== Setup Section ====
The first lines of a program should be your setup instructions. This often means zeroing registers and setting constants to be used later. It's also a good idea to set all your outputs to ideal conditions. We can do this quickly using our [[Best Practices|best practices]] PR[2] which is set to zero.
The first lines of a program should be your setup instructions. This often means zeroing registers and setting constants to be used later. It's also a good idea to set all your outputs to ideal conditions. We can do this quickly using a single register instruction.

Examples:
Examples:


'''PR[5]=PR[2:Zero]'''
'''PR[5]=PR[5]-PR[5]'''


<br />
<br />

Revision as of 13:42, 25 May 2019

Program structure for Fanuc robots is top down. That is, the instructions will run in order. Jumps will continue right after their destination LBL, CALLs will run from top to bottom and continue once they reach the called program's END with the line after the original CALL.


Setup Section

The first lines of a program should be your setup instructions. This often means zeroing registers and setting constants to be used later. It's also a good idea to set all your outputs to ideal conditions. We can do this quickly using a single register instruction.

Examples:

PR[5]=PR[5]-PR[5]


Intro Motion

It can be useful to include motion instructions that take your robot to a known position, in case of power failure or a prior program leaving off in a weird place. Use a Joint move to ensure you don't enter singularity.

J P[1:Home] 20% FINE


Inputs

While inputs can be read anywhere in your program, it can be helpful to organize them into a small section that can be run through at points where it really matters.

IF DI[101] = ON JMP LBL[4]

IF DI[102] = ON JMP LBL[5]

IF DI[103] = ON JMP LBL[6]

IF DI[104] = ON JMP LBL[7]

JMP LBL[8]


Configuration

Depending on program state, input values, counts, times, and other variables - you can set up configuration data to match. This lets you run short, efficient motion instructions with few or no special sections.

LBL [4]

PR[10,3] = 5

R[12] = R [12] + 1

LBL [5]

PR[10,3] = 7

R[12] = R [12] + 2

LBL [6]

PR[10,3] = 25

R[12] = R [12] + 1

LBL [7]

PR[10,3] = 33

R[12] = R [12] + 2


Motion

Your motion lines should be efficient and minimalist. Anything that can be done with a new tool frame, user frame, offset, and registers should be, instead of having lots of similar motion lines.

J P[1] 100% Fine OFFSET PR[10]

L P[2] 222mm/s Fine OFFSET PR[10]

L P[5] R[11] Fine OFFSET PR[10]

L P[3] 222mm/s Fine OFFSET PR[10]

C P[8] 222mm/s Fine OFFSET PR[10] ...P[6] R[11] Fine OFFSET PR[10]