Aregister stores one number. Up to 999 registers are available for all the programs in the controller combined. The default number of registers is 32. Registers are identified by numbers. You can increase the number of registers during a controlled start. Refer to the “ System Operations” Appendix in the Setup and Operations Manual for information on performing a Controlled start. Register instructions manipulate register data arithmetically.
Many instructions employdirect or indirect addressing techniques. When direct addressing is used, the actual value is entered into the instruction. For example, if the register instruction R[2]= 5 is used, the current contents of register 2 is replaced with the value 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. See Figure 106, " Direct and Indirect Addressing Example " .
In Figure 106, " Direct and Indirect Addressing Example " , the first instruction illustrates direct addressing. This instruction causes the current contents of register 3 to be replaced with the value 2.
The second instruction in Figure 106, " Direct and Indirect Addressing Example " illustrates indirect addressing. In this instruction, R[3] is the internal register and R[R[3]] is the external register. Since in the previous instruction the value of the internal register R[3] is 2, the external register number becomes R[R[3]=2] or R[2]. Therefore, the result of the second instruction is that the contents of the external register, R[2], is to be replaced with the value 5.
The R[x] = [value] instruction stores a value in a register. See Figure 107, " R[x] = [value] " .
The R[x] = [value] [operator] [value] instructions store the result of an arithmetic operation in a register. The arithmetic operations are
Addition
Subtraction
Multiplication
Division
Whole number division (DIV)
Remainder division (MOD)
See Figure 108, " R[x] = [value] [operator] [value] " .
You can use multiple arithmetic operators in a single instruction. However, there are the following 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 operators you can have in the same instruction is 5.