Registers: Difference between revisions

 
(5 intermediate revisions by the same user not shown)
Line 1:
<br />[[File:REGISTER Instruction menu.png|thumb|600x600px|REGISTER Instruction menu]]
'''Hello! You've reached a page in progress. Currently, the "valid variables" section of each instruction on this page needs to be expanded to note the validity of each regarding their data types. Additionally, better page organization is required as separating each into headings and subheadings is visually displeasing. Check back soon for changes!'''[[File:REGISTER Instruction menu.png|thumb|600x600px|REGISTER Instruction menu]]
''This page details the Register Instructions available on the FANUC Teach Pendant Programmers. For information on the data within the variables, see [[Data|Data.]]''
 
Register instructions do not involve motion. They are simply math operations with one or more inputs and an output.
 
When the program reaches a register instruction, it completes the math operation, overwrites the destination variable, and moves forward.
 
The leftmost variable in a register instruction is where the result is stored. Everything to the right of the equal sign is the equation to be performed.
 
{| class="wikitable"
Line 63 ⟶ 65:
|Mixed Logic
|}
A common use for Register instructions is a counter that increases the value of a register by one each time a program runs.
Note that Position Registers must be initialized before any instructions that use them can run. For instructions on how to initialize a position register, see
 
Example:
==Equals Instruction==
 
R[1] = R[1] + 1
 
This will take whatever is in R[1], add 1 to it, and store it to R[1]. Every time you run a program that contains this line, it will count up. This means a technician can walk up to a robot cell and glance at the register's contents to know exactly how many times the robot performed its task.
 
 
Below is a detailed explanation with examples of each of the register instructions from the table above.
 
==Equals Instruction==
 
{| class="wikitable"
Line 129 ⟶ 138:
 
=== When this instruction is reached ===
 
===When this instruction is reached ===
 
Line 503 ⟶ 511:
Anything minus itself will always equal zero, so no matter what the contents of each element in the position register happen to be, it will become zero after this instruction is reached.
Since position registers are global variables, they may be used in other programs and can contain values that are unrelated to your own. You should never assume a position register will be at specific values before the program begins. It is best, whenever possible, to design your program based on the starting values of zero and simply add the subtraction instruction in the beginning of your program, outside any loops that may depend on changes to the variable.
 
==Division Instruction ==
Line 885 ⟶ 893:
|}
===When this instruction is reached ===
It will perform whatever equation it contains and store to the variable to the left of the equal sign.
===When to ===
 
===When to add this instruction ===
This option lets you manually build register instructions using variables and operations that may not come up in the default listing of options. For example, certain software packages use their own variable types that are outside the scope of the original menus. Additionally, you may have to use mixed logic when building an equation in an IF statement if the variables you are comparing are individual position register elements.
 
===What else is needed to use this instruction ===
None
 
===Valid Variables ===
All available variables. It will let you enter invalid choices as well, although they won't run and will error out when the instruction is reached in a running program.
 
===Special Notes ===
It is easy to accidentally build a mixed logic instruction incorrectly. Unlike the default choices, mixed logic won't force you to choose valid options and variables as you build it. Extra parenthesis are a common mistake and it may take some doing to ensure you have an equal amount of opening and closing parenthesis.
 
__NOTOC__