The text of a manual · part 28 of 36
DL305 User Manual, pages 267 to 276
Pages 267 to 276 of 356
The original document is the PDF (3.2 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the GE DL330 / D3-330, Fanuc DL330 / D3-330 and GE Fanuc DL330 / D3-330
Page 267
Instruction Set Accumulator Load and Output Instructions
The Data Store 5 (F55) is a 16–bit instruction that loads the value of 16 image register locations for a specified 16 point input module into the accumulator.
DSTR 5 (F55) R aaa
Data Out 5 DOUT (F65)
The Data Out 5 (F65) is a 16–bit instruction that outputs the 16 bit value in the accumulator to the image register of a specified 16 point output module.
DOUT 5 (65) R aaa
Data Type
D3–330 Range
Inputs / Outputs
R
D3–340 Range
D3–330P Range aaaa aaaa aaaa
000–014 070–075
000–014 070–075
000–014 070–075
In the following example, when input 000 is on the binary status of a 16 point I/O module in slot 1 (R000 and R010) is loaded into the accumulator using the Data Store 5 (F55) instruction. The value in the accumulator is copied to I/O register locations in slot 2 (R001 and R011) using the Data Out 5 (F65) instruction. DirectSOFT Display
Handheld Programmer Keystrokes
000 DSTR5 (F55) R 000
R
Loads status of 16 point input image register (R000 and R010) to accumulator
0
1
0
R
0
0
0
7
I/O Points 100-107 6 5 4 3 2 1 0
7
I/O Points 000-007 6 5 4 3 2 1 0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
1
Load status of 16 pt. input module into the accumulator
Acc.
15 14 13 12 11 10 9
8
7
6
5
4
3
2
1
0
0
0
0
0
0
0
1
0
0
1
1
0
0
0
0
0
I/O Points 100-107
R
DOUT5 (F65) R 001 Copy the value in the accumulator to R001 and R011
0
1
I/O Points 000-007
1
R
I/O Points 110-117
0
0
1
I/O Points 010-017
7
6
5
4
3
2
1
0
7
6
5
4
3
2
1
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
1
STR F
SHF 5
0 5
ENT ENT
R F
0 6 1
ENT 5 ENT
ENT
R
Instruction Set
Data Store 5 DSTR (F55)
11–29
Page 268
11–30
Instruction Set Accumulator Logic Instructions
Instruction Set
Accumulator Logic Instructions Data And DAND (F75)
The Data And (F75) is a 16–bit instruction that logical ands the value in a 16–bit reference, two consecutive 8–bit registers (specify starting location), or a 4–digit BCD constant with the value in the accumulator. The result resides in the accumulator. Data Type
D3–330 Range
DAND (F75) A aaaa
D3–340 Range
D3–330P Range
A aaaa aaaa aaaa
Inputs / Outputs
R
000–014 070–075
000–014 070–075
000–014 070–075
Control Relays
R
016–036
016–036 100–105
016, 020–027
Shift Registers
R
040–056
040–056
––
Stages
R
––
––
100–116
Timer /Counters (16 bit)
R
600–677
600–677
600–677
Data Registers
R
400–577
400–577 700–777
400–577
Constant (4–digit BCD)
K
0000–9999
0000–9999
0000–9999
In the following example, when input 000 is on the value(6489) in R402 and R403 is loaded into the accumulator using the Data Store (F50) instruction. The data in the accumulator is logically anded with the constant K4107 with the result residing in the accumulator. The value in the accumulator is output to data register R404 and R405 using the Data Out (F60) instruction. DirectSOFT Display
Handheld Programmer Keystrokes
000 DSTR (F50) R 402 Load the value in register R402 and R403 into the accumulator Acc.
DAND (F75) K4107 AND the value in the accumulator with the constant value 4107
DOUT (F60) R 404
AND
STR F
SHF 5
0 0
ENT ENT
R F SHF
4 7 4
0 5 1
2 ENT 0
F R
6 4
0 0
ENT 4
R402
6
8
4
7
6
5
4
3
2
1
0
7
6
5
4
3
2
1
0
0
1
1
0
0
1
0
0
1
0
0
0
1
0
0
1
0
1
1
0
0
1
0
0
1
0
0
0
1
0
0
1
Accumulator
0
1
0
0
0
0
0
1
0
0
0
0
0
1
1
1
Constant (4107)
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
Accumulator
4
0
0
1
R405 Output the value in the accumulator to registers R404 and R405
9
R403
R404
ENT 7 ENT
ENT
Page 269
11–31
Instruction Set Accumulator Logic Instructions
The Data Or (F76) is a 16–bit instruction that logically ors the value in a 16–bit reference, two consecutive 8–bit registers, (specify starting location) or a 4–digit BCD constant with the value in the accumulator. The result resides in the accumulator. Data Type
DOR (F76) A aaaa
D3–330 Range
D3–340 Range
A aaaa aaaa aaaa
Inputs / Outputs
R
000–014 070–075
000–014 070–075
000–014 070–075
Control Relays
R
016–036
016–036 100–105
016, 020–027
Shift Registers
R
040–056
040–056
––
Stages
R
––
––
100–116
Timer /Counters (16 bit)
R
600–677
600–677
600–677
Data Registers
R
400–577
400–577 700–777
400–577
Constant (4–digit BCD)
K
0000–9999
0000–9999
0000–9999
Instruction Set
Data Or DOR (F76)
D3–330P Range
In the following example, when input 000 is on the value (6481) in R402 and R403 is loaded into the accumulator using the Data Store (F50) instruction. The data in the accumulator is logically ored with the constant K4102 with the result residing in the accumulator. The value in the accumulator is output to data registers R404 and R405 using the Data Out (F60) instruction. DirectSOFT Display
Handheld Programmer Keystrokes
000 DSTR (F50) R 402 Load the value in register R402 and 403 into the accumulator
7 Acc.
DOR (F76) K4102 AND the value in the accumulator with the constant value 4102
DOUT (F60) R 404
OR
0
6 1
5 1
STR F
SHF 5
0 0
ENT ENT
3
R F K
4 7 4
0 6 1
2 ENT 0
F R
6 4
0 0
ENT 4
R402
6
8
4 0
4
3 0
2 1
1 0
0 0
7 1
6 0
5 0
4 0
0
2 0
1 0
0 1
0
1
1
0
0
1
0
0
1
0
0
0
0
0
0
1
Accumulator
0
1
0
0
0
0
0
1
0
0
0
0
0
0
1
0
Constant (4102)
0
1
1
0
0
1
0
1
1
0
0
0
0
0
1
1
Accumulator
6
5
8
3
R405 Output the value in the accumulator to registers R404 and R405
1
R403
R404
ENT 2 ENT
ENT
Page 270
Instruction Set
11–32
Instruction Set Accumulator Logic Instructions
Compare CMP (F70)
The Compare (F70) is a 16–bit instruction that compares the value in a 16–bit reference, two consecutive 8–bit registers (specify starting location), or a 4–digit BCD against the value in the accumulator. Discrete bit flags are used to indicate if the result of the comparison was greater than, equal to, or less than the value in the accumulator. Data Type
CMP (F70) A aaaa
D3–330 Range
D3–340 Range
A aaaa aaaa
D3–330P Range aaaa
Inputs / Outputs
R
000–014 070–075
000–014 070–075
000–014 070–075
Control Relays
R
016–036
016–036 100–105
016, 020–27
Shift Registers
R
040–056
040–56
––
Stages
R
––
––
100–116
Timer /Counters (16 bit)
R
600–677
600–677
600–677
Data Registers
R
400–577
400–577 700–777
400–577
Constant (4–digit BCD)
K
0000–9999
0000–9999
0000–9999
Discrete Bit Flags
Description
772
Will be on if the accumulator value is greater than the compare value
773
Will be on if the accumulator value is equal to the compare value
774
Will be on if the accumulator value is less than the compare value
Page 271
11–33
Instruction Set Accumulator Logic Instructions
DirectSOFT Display
Handheld Programmer Keystrokes
000 DSTR (F50) R 402 Load the value in registers 402 and 403 into the accumulator
R 403
R 402
2
1
3
Acc.
2
1
3
2
2
Compared with CMP (F70) R 404 Compare the value in the accumulator with the value in registers 404 and 405 000
774
160
7
5
R405
0
2
STR F
SHF 5
0 0
ENT ENT
R F R STR AND
4 7 4 SHF SHF
0 0 0 0 7
2 ENT 4 ENT 7
ENT
4
ENT
OUT
SHF
1
6
0
ENT
ENT
R404
772 Accumulator value is greater than compare value
OUT 773 Flag status after Compare execution 772 off 773 off 774 on
Accumulator value is equal to compare value 774 Accumulator value is less than compare value
NOTE: Input 000 has been used to interlock output 160. This is done since an earlier comparison could result in status flag 774 coming on when this particular comparison is not being executed thereby providing the opportunity for an unexpected output signal on output 160. It is a common mistake to just use the status flags without interlocking to control outputs in a program but, status flags 772 – 774 can change several times during the same scan. Just as you should not use the status flags by themselves to control outputs, you also should not monitor status flags within the program. Instead you should monitor the interlocked outputs controlled by the status flags.
Instruction Set
In the following example, when input 000 is on the value (2132) in R402 and R403 is loaded into the accumulator using the Data Store (F50) instruction. The data in the accumulator is compared to value in data registers R404 and R405 using the Compare (F70) instruction. Discrete status flag 774 is used to indicate if the accumulator is less than the compare value in this example.
Page 272
11–34
Instruction Set Math Instructions
Instruction Set
Math Instructions Add ADD (F71)
The Add (F71) is a 16–bit instruction that adds the value of a 16 bit reference, two consecutive 8–bit registers (specify starting location), or a 4–digit BCD value with the value in the accumulator. The result resides in the accumulator. Discrete bit flags are used to indicate if the result had a carry digit or if the result was was zero. Data Type
ADD (F71) A aaaa
D3–330 Range
D3–340 Range
A aaaa aaaa
D3–330P Range aaaa
Inputs / Outputs
R
000–014 070–075
000–014 070–075
000–014 070–075
Control Relays
R
016–036
016–036 100–105
016, 020–027
Shift Registers
R
040–056
040–056
––
Stages
R
––
––
100–116
Timer /Counters (16 bit)
R
600–677
600–677
600–677
Data Registers
R
400–577
400–577 700–777
400–577
Constant (4–digit BCD)
K
0000–9999
0000–9999
0000–9999
Discrete Bit Flags
Description
775
Will be on if the operation results in a carry
776
Will be on if the result is 0
In the following example, when input 000 is on the value (3619) in R402 and R403 is loaded into the accumulator using the Data Store (F50) instruction. The Add instruction (F71) adds the value (2602) in R410 and R411 to the value in the accumulator. The result in the accumulator is then copied to data registers R404 and R405 with the Data Out (F60) instruction. DirectSOFT Display
Handheld Programmer Keystrokes
000 DSTR (F50) R 402
R 403
R 402
3
6
1
9
3
6
1
9
Accumulator
2
6
0
2
(R410 and R411)
6
2
2
1
Accumulator
6
2
2
1
Load the value in registers R402 and R403 into the accumulator ADD (F71) R410
+
Add the value in the accumulator with the value in registers R410 and R411 DOUT (F60) R 404 Copy the value in the accumulator to registers R404 and R405
R 405
R 404
777 Carry bit 776 Result equal 0
STR F
SHF 5
0 0
ENT ENT
R F R
4 7 4
0 1 1
2 ENT 0
F R
6 4
0 0
ENT 4
ENT ENT ENT
Page 273
Instruction Set Math Instructions
Add Example
11–35
Registers for DSTR Instruction
Registers for ADD Instruction
Registers for DOUT Instruction
Discrete Status Flag
Discrete Status Flag
R401/R400
R403/R402
R405/R404
775
776
Example 1
500
400
0900 off off
Example 2
5000
5000
0000 on on
Example 3
5050
5000
0050 on off
DirectSOFT Display
Handheld Programmer Keystrokes
000 DSTR (F50) R 400 Load the value in registers R400 and R401 into the accumulator ADD (F71) R402 Add the value in the accumulator with the value in registers R402 and R403 DOUT (F60) R 404
STR F
SHF 5
0 0
ENT ENT
R F R
4 7 4
0 1 0
0 ENT 2
F R
6 4
0 0
ENT 4
ENT
STR OUT
SHF SHF
7 0
7 1
5 0
ENT ENT
STR OUT
SHF SHF
7 0
7 1
6 1
ENT ENT
ENT ENT
Output the value in the accumulator to registers R404 and R405 000
775
010 OUT Output 010 will be on if the operation results in a carry
000
776
011 OUT Output 011 will be on if the result of the addition is zero
NOTE: An input has been used to interlock the outputs on the last two rungs. This is done since an earlier math instruction could result in the status flag coming on when this particular math instruction is not being executed thereby providing the opportunity for an unexpected output signal. It is a common mistake to just use the status flags without interlocking to control outputs in a program but, the status flags can change several times during the same scan. Just as you should not use the status flags by themselves to control outputs, you also should not monitor status flags within the program. Instead you should monitor the interlocked outputs controlled by the status flags.
Instruction Set
The following examples demonstrate how the discrete status flags are used to indicate if the result of the add has produced a number which exceeds the capacity of the accumulator. Remember, the accumulator has a 4 digit maximum. When a calculation produces a number larger than 4 digits, part of this number is lost. The following table shows different values being used in the logic example below. Notice how the discrete status flags change.
Page 274
Instruction Set
11–36
Instruction Set Math Instructions
Subtract SUB (F72)
The Subtract (F72) is a 16–bit instruction that subtracts the value in a 16–bit register, two consecutive 8–bit registers (specify starting location), or a 4–digit BCD value from the value in the accumulator. The result resides in the accumulator. Discrete bit flags are used to indicate if the result had a borrow digit or the result was zero. Data Type
SUB (F72) A aaaa
D3–330 Range
D3–340 Range
A aaaa aaaa
D3–330P Range aaaa
Inputs / Outputs
R
000–014 070–075
000–014 070–075
000–014 070–075
Control Relays
R
016–036
016–036 100–105
016, 020–027
Shift Registers
R
040–056
040–056
––
Stages
R
––
––
100–116
Timer /Counters (16 bit)
R
600–677
600–677
600–677
Data Registers
R
400–577
400–577 700–777
400–577
Constant (4–digit BCD)
K
0000–9999
0000–9999
0000–9999
Discrete Bit Flags
Description
775
Will be on if the result if a borrow digit occurred
776
Will be on if the result is 0
In the following example, when input 000 is on the value (3619) in R402 and R403 is loaded into the accumulator using the Data Store (F50) instruction. The constant value K1406 is subtracted from the value in the accumulator using the Subtract (F72) instruction. The result in the accumulator is then copied to data registers R404 and R405 using the Data Out (F60) instruction. DirectSOFT Display
Handheld Programmer Keystrokes
000 DSTR (F50) R 402 Load the value in registers R402 and R403 into the accumulator SUB (F72) K1406
–
Subtract the value in the accumulator with the value in registers R402 and R403
DOUT (F60) R 404 Output the value in the accumulator to registers R404 and R405
R 403
R 402
3
1
6
9
3
6
1
9
Accumulator
1
4
0
6
Constant (K1406)
2
2
1
3
Accumulator
2
2
1
3
R 405
R 404
775 Borrow digit 776 Result equal 0
STR F
SHF 5
0 0
ENT ENT
R F SHF
4 7 1
0 2 4
2 ENT 0
F R
6 4
0 0
ENT 4
ENT 6 ENT
ENT
Page 275
Instruction Set Math Instructions
Subtract Example
11–37
Registers for DSTR Instruction
Registers for SUB Instruction
Registers for DOUT Instruction
Discrete Status Flag
Discrete Status Flag
R401/R400
R403/R402
R405/R404
775
776
Example 1
6050
5000
1050 off off
Example 2
7050
7050
0000 off on
Example 3
5000
6000
9000* on off
* The DL305 cannot process negative numbers. When the number being subtracted from the accumulator is larger than the number in the accumulator, a borrow digit occurs and the subtraction is completed. The value in the accumulator does not represent the difference between the two numbers. To get the difference between the two numbers in Example 3 the result (9000) in the accumulator is subtracted from 0. The final result is 1000, the difference between 6000 and 5000. DirectSOFT Display
Handheld Programmer Keystrokes
000 DSTR (F50) R 400 Load the value in registers R400 and R401 into the accumulator SUB (F72) R402 Subtract the value in the accumulator with the value in registers R402 and R403 DOUT (F60) R 404
000
775
Output the value in the accumulator to registers R404 and R405 DSTR (F50) K0
STR F
SHF 5
0 0
ENT ENT
R F R
4 7 4
0 2 0
0 ENT 2
F R STR
6 4 SHF
0 0 0
ENT 4 ENT
AND F
SHF 5
7 0
7 ENT
R F K
4 7 0
0 2 ENT
4 ENT
F R
6 4
0 0
ENT 4
ENT ENT ENT 5
ENT
ENT
Load the constant zero (0) into the accumulator
SUB (F72) R404 Subtract the value in the accumulator with the value in registers R404 and R405
DOUT (F60) R 404 Output the value in the accumulator to registers R404 and R405
NOTE: It is a common mistake to just use the status flags without interlocking to control outputs in a program, but the status flags can change several times during the same scan. Just as you should not use the status flags by themselves to control outputs, you also should not monitor status flags within the program. Instead you should monitor the interlocked outputs controlled by the status flags.
Instruction Set
The following examples demonstrate how the discrete status flags are used to indicate if the result of the Subtraction is a 0 or required a borrow digit. The following table shows different values being used in the logic example below. Notice how the discrete status flags change for each example.
Page 276
Instruction Set
11–38
Instruction Set Math Instructions
Multiply MUL (F73)
The Multiply (F73) is a 16–bit instruction that multiplies the value in a 16–bit register, two consecutive 8–bit registers, or a 4–digit BCD value by the value in the accumulator. The least significant four digits of the result are stored in the accumulator and the most significant four digits are stored in the auxiliary accumulator (R575 and R577). A discrete bit flag is used to indicate if the result was zero. Data Type
MUL (F73) A aaaa
D3–330 Range
D3–340 Range
A aaaa aaaa
D3–330P Range aaaa
Inputs / Outputs
R
000–014 070–075
000–014 070–075
000–014 070–075
Control Relays
R
016–036
016–036 100–105
016, 020–027
Shift Registers
R
040–056
040–056
––
Stages
R
––
––
100–116
Timer /Counters (16 bit)
R
600–677
600–677
600–677
Data Registers
R
400–577
400–577 700–777
400–577
Constant (4–digit BCD)
K
0000–9999
0000–9999
0000–9999
Discrete Bit Flags
Description
776
Will be on if the result is 0
In the following example, when input 000 is on the value (3619) in R402 and R403 is loaded into the accumulator using the Data Store (F50) instruction. The data in the accumulator is multiplied with the constant K2 with the result residing in the accumulator and auxiliary accumulator (R576 and R577) using the Multiply (F73) instruction. The value in the accumulator is output to data registers R404 and R405 using the Data Out (F60) instruction. DirectSOFT Display
Handheld Programmer Keystrokes
000 DSTR (F50) R 402 Load the value in registers R402 and R403 into the accumulator
3
1
6
6
1
X 0
0
0
0
Auxilliary Acc. R 577 R 576
7
2
3
9
9
Accumulator
2
Constant (K2)
8
Accumulator
7
DOUT (F60) R404 Copy the value in the accumulator to registers R404 and R405
R 402
3
MUL (F73) K2 Multiply the value in the accumulator with the constant 2
R 403
2
R 405
3
8
R 404
776 Result equal 0
STR F
SHF 5
0 0
ENT ENT
R F SHF
4 7 2
0 3 ENT
2 ENT
F R
6 4
0 0
ENT 4
ENT
ENT