The text of a manual · part 41 of 68
DL405 User Manual: Chapter 5: Standard RLL Instructions, pages 363 to 372
Pages 363 to 372 of 608, from DL405 User Manual
The original document is the PDF (8.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 AutomationDirect D4-08B-1, AutomationDirect D4-08ND3S, AutomationDirect D4-16TA, PLC Direct D4-16TD2, AutomationDirect D4-32ND3-1, Konnect-It D4-08B-1, Koyo D4-08B-1, Konnect-It D4-08ND3S, and 6 more models
Page 363
Standard RLL Instructions Network Instructions
5--191
Network Instructions Read from Network The Read from Network instruction is used by the master device (CPU with a DCM) on (RX) a network to read a block of data from another CPU. The function parameters are 430 440 450 loaded into the first and second level of the accumulator stack and the accumulator by HPP DS three additional instructions. Listed below are the steps necessary to program the Read from Intelligent module function.
RX A aaa
Step 1:, Load the slave address (1--90 BCD) into the first byte and the slot number of the master DCM (0--7) into the second byte of the second level of the accumulator stack. (Note: address 0 is only valid for peer stations.) Step 2:, Load the number of bytes (2--128 BCD, multiple of 2) to be transferred into the first level of the accumulator stack. Step 3:, Load the address where you want to store the data in the master station. The address must be specified in HEX. Step 4:, Insert the RX instruction and specify the starting V--memory location (Aaaa) in the slave CPU where the data will be obtained. Helpful Hint:, For parameters that require HEX values, the LDA instruction can be used to convert an octal address to the HEX equivalent and load the value into the accumulator. Operand Data Type
DL430 Range
DL440 Range
DL450 Range
A aaa aaa aaa
V--memory
V
All (See p. 3--40)
All (See p. 3--41)
All (See p. 3--42)
Inputs
X
0--477
0--477
0--1777
Outputs
Y
0--477
0--477
0--1777
Control Relays
C
0--737
0--1777
0--3777
Stage
S
0--577
0--1777
0--1777
Timer
T
0--177
0--377
0--377
Counter
CT
0--177
0--177
0--377
Special Relay
SP
0--137, 320--617
0--137 320--717
0--137 320--717
Global I/O
GX
0--777
0--1777
0--2777
Program Memory
L$
0--3583
0--7679 (7.5K program mem.) 0--15871 (15.5K program mem.)
0--7679 (7.5K program mem.) 0--15871 (15.5K program mem.)
Scratchpad
Z
0--FFFF
0--FFFF
0--FFFF
DL405 User Manual, 4th Edition
Standard RLL Instructions
NOTE: If you are using a CoProcessor, Share Data Network, or DCM module, please refer to their manuals for information on how to transfer data over the DirectNET network.
Page 364
5--192
Standard RLL Instructions Network Instructions In the following example, when X1 is on and the module busy relay SP124 (see special relays) is not on, the RX instruction will access a DCM operating as a master in slot 2. Ten consecutive bytes of data (V1400 -- V1404) will be read from a CPU at station address 5 and copied into V-memory locations V2500--V2504 in the CPU with the master DCM. Master CPU
DirectSOFT X1
SP124
LD K 0205
S S
The constant value K0205 specifies the slot number (2) and the slave address (5) LD K 10 The constant value K10 specifies the number of bytes to be read
V2500
3
4
5
7
3
4
5
7
8
5
3
4
8
5
3
4
V1401
V2502
1
9
3
6
1
9
3
6
V1402
V2503
9
5
7
1
9
5
7
1
V1403
V2504
1
4
2
3
1
4
2
3
V1404
V2505
X
X
X
X
X
X
X
X
V1405
S S
O 2500
RX V1400 V1400 is the starting location in the DL405 slave CPU where the specified data will be obtained.
Write to Network (WX)
Standard RLL Instructions
430 440 450
DS
HPP
S S
V2501
LDA
Octal address 2500 is converted to 540 HEX and loaded into the accumulator. V2500 is the starting location for the Master CPU where the specified data will be stored
Slave CPU V1400
S S
Handheld Programmer Keystrokes STR
X(IN)
1
AND
NOT
SPCL
1
2
4
LD
K(CON)
0
2
0
5
LD
K(CON)
1
0
LD
SHFT
A
OCT
2
5
0
0
SHFT
R
X
SHFT
V
1
4
0
The Write to Network instruction is used to write a block of data from the master device (CPU with a DCM) to a slave device on the same network. The function parameters are loaded into the first and second level of the accumulator stack and the accumulator by three additional instructions. Listed below are the steps necessary to program the Write to Network function.
0
WX A aaa
Step 1:, Load the slave address (1--90 BCD) into the first byte and the slot number of the master DCM (0--7) into the second byte of the second level of the accumulator stack. (Note: address 0 is only valid for peer stations.) Step 2:, Load the number of bytes (2--128 BCD, multiple of 2) to be transferred into the first level of the accumulator stack. Step 3:, Load the address where you want to obtain the data in the master station. The address must be specified in HEX. Step 4:, Insert the WX instruction and specify the starting V--memory location (Aaaa) in the slave CPU where the data will be stored. Helpful Hint:, For parameters that require HEX values, the LDA instruction can be used to convert an octal address to the HEX equivalent and load the value into the accumulator.
DL405 User Manual, 4th Edition
Page 365
5--193
Standard RLL Instructions Network Instructions
Operand Data Type
DL430 Range
DL440 Range
A aaa aaa
DL450 Range aaa
V--memory
V
All (See p. 3--40)
All (See p. 3--41)
All (See p. 3--42)
Inputs
X
0--477
0--477
0--1777
Outputs
Y
0--477
0--477
0--1777
Control Relays
C
0--737
0--1777
0--3777
Stage
S
0--577
0--1777
0--1777
Timer
T
0--177
0--377
0--377
Counter
CT
0--177
0--177
0--377
Special Relay
SP
0--137, 320--617
0--137 320--717
0--137 320--717
Global I/O
GX
0--777
0--1777
0--2777
Program Memory
$
0--3585
0--7679 (7.5K program mem.) 0--15873 (15.5K program mem.)
0--7679 (7.5K program mem.) 0--15873 (15.5K program mem.)
Scratchpad
Z
0--FFFF
0--FFFF
0--FFFF
NOTE: If you are using a CoProcessor, Share Data Network, or DCM module, please refer to their manuals for information on how to transfer data over the DirectNET network. In the following example when X1 is on and the module busy relay SP124 (see special relays) is not on, the WX instruction will access a DCM operating as a master in slot 2. 10 consecutive bytes of data is read from the CPU at station address 5 and copied to V--memory locations V1400--V1404 in the slave CPU. Master CPU
DirectSOFT X1
SP124
LD K 0205
S S
The constant value K0205 specifies the slot number (2) and the slave address (5) LD K10 The constant value K10 specifies the number of bytes to be read
3
4
5
7
3
4
5
7
V1400
V2501
8
5
3
4
8
5
3
4
V1401
V2502
1
9
3
6
1
9
3
6
V1402
V2503
9
5
7
1
9
5
7
1
V1403
V2504
1
4
2
3
1
4
2
3
V1404
V2505
X
X
X
X
X
X
X
X
V1405
S S
O 2500
V1400 V1400 is the starting location in the DL405 Slave CPU where the data will be stored.
S S
Handheld Programmer Keystrokes STR
X(IN)
1
AND
NOT
SPCL
1
2
4
LD
K(CON)
0
2
0
5
LD
K(CON)
1
0
LD
SHFT
A
OCT
2
5
0
0
SHFT
W
X
SHFT
V
1
4
0
0
DL405 User Manual, 4th Edition
Standard RLL Instructions
WX
S S
V2500
LDA
Octal address 2500 is converted to 540 HEX and loaded into the accumulator. V2500 is the starting location for the Master CPU where the specified data will be obtained.
Slave CPU
Page 366
5--194
Standard RLL Instructions Message Instructions
Message Instructions System Errors and The DL405 CPUs provide error logging capabilities. There are certain predefined system error messages and codes, but you can also use the Fault instruction to Fault Messages create your own specific messages. The CPU logs the error, the date, and the time the error occurred. There are two separate tables that store this information. S System Error Table -- both the DL430 and DL440 have several predefined system error codes. The DL430 can hold one error at a time. The DL440 can show up to 32 errors in an error table. When an error occurs, the error is loaded into the first available location. Therefore, the most recent error may not appear in the top row of the table. If the table is full when an error occurs, the oldest error is pushed (erased) from the table and the new error is inserted in the row. S Fault Message Table -- the DL430 and DL440 also allow you to build your own error codes and messages. These are called Fault Messages. With the DL430, you can only build numeric error codes. With the DL440, you can build error codes, or up to 16 messages that can contain up to 23-character alphanumeric characters. In either case, you can have up to 16 messages or codes shown in the table. When a message is triggered, it is put in the first available table location. Therefore, the most recent error may not appear in the top row of the table. If the table is full when an error occurs, the oldest error is pushed (erased) from the table and the new error is inserted in the row. The following diagram shows an example of a the Fault Message table as shown in DirectSOFT. You cannot view the entire table at one time with the handheld programmer. Instead, the messages automatically appear on the handheld programmer display as they occur. The message will remain on the display as long as the Fault instruction is being executed. You can also use an Auxiliary function (5C) to view the messages one at a time. (More on the handheld programmer display later.) DL440 Error Msg. Example Most recent message appears here, not at the top of the table.
Standard RLL Instructions
Next message will show up in this row, which is now the oldest message. There are several instructions that can be used in combination to create these error codes and messages. S FAULT -- Fault S DLBL -- Data Label S ACON -- ASCII Constant S NCON -- Numeric Constant The next few pages provide details on these instructions. Also, at the end of this section, there are two examples that show how the instructions are used together.
DL405 User Manual, 4th Edition
Page 367
Standard RLL Instructions Message Instructions
Fault (FAULT)
430 440 450
DS
HPP
In a DL440 or DL450, the Fault instruction is used to display a message or numeric error code on the handheld programmer, FAULT DirectSOFT screen, or DV--1000 Operator A aaa Interface display. The message has a maximum of 23 characters and can be either V--memory data, numerical constant data or ASCII text. To display a value in a V--memory location, specify the V--memory location in the instruction. To display ASCII or numeric data, you must use the DLBL (Data Label) instruction, and ACON (ASCII constant) or NCON (Numeric constant) instructions, in conjunction with the Fault instruction. In this case, you should specify the constant (K) value in the Fault instruction for the corresponding data label area that contains the ACON and/or NCON instructions. Operand Data Type
Fault (FAULT)
430 440 450
DS
HPP
5--195
DL440 Range
DL450 Range
A aaa aaa
V--memory
V
All (See p. 3--41)
All (See p. 3--42)
Constant
K
1--FFFF
1--FFFF
In a DL430, the Fault instruction is used to display a numeric error code on the handheld programmer, DirectSOFT screen, or FAULT DV--1000 Operator Interface display. A aaa The error code may be obtained from a V-memory location, or may be constructed by specifying a constant in the Fault instruction. To display the value in a V--memory location, specify the V--memory location in the instruction. To display a numeric constant, specify the constant (K) value in the instruction. Operand Data Type
DL430 Range A aaa
V--memory
V
All (See p. 3--40)
Constant
K
1--FFFF
DL405 User Manual, 4th Edition
Standard RLL Instructions
NOTE: The DL430 does not support the necessary instructions to build alphanumeric error messages. You can only build error codes by obtaining the code from a V--memory location, or by specifying a constant in the Fault instruction.
Page 368
5--196
Standard RLL Instructions Message Instructions
Data Label (DLBL)
430 440 450
DS
HPP
The Data Label instruction marks the beginning of an ASCII/numeric data area and is typically used with ACON and NCON instructions. DLBLs are programmed after the End statement. A maximum of 64 DLBL instructions can be used in a program. Multiple NCONs and ACONs can be used in a DLBL area. Examples are shown later in this section. Operand Data Type
Constant
K
DLBL
DL430 Range
DL440 Range aaa aaa
DL450 Range aaa
----
1--FFFF
1--FFFF
ASCII Constant (ACON)
The ASCII Constant instruction is used with the DLBL instruction to store ASCII text for use with other instructions. The instruction is utilized differently between the handheld programmer and our DirectSOFT programming software.
430 440 450
Handheld Programmer: With a handheld programmer, two ASCII characters can be stored in an ACON instruction. If only one character is stored in an ACON, a leading space will be printed in the Fault message.
DS
HPP
Operand Data Type
ASCII
A
ACON A aaa
DL430 Range
DL440 Range aaa aaa aaa
----
0--9 A--Z
0--9 A--Z
DirectSOFT Programming Software: If you’re using DirectSOFT, you can store up to 40 characters in an ACON. Also, you have a much wider range of characters that are supported. (See Appendix G for a complete listing of ASCII characters available.) Operand Data Type
ASCII
Standard RLL Instructions
K aaa
A
DL450 Range
ACON A aaa Note, even though it is shown here for clarification, the “A” does not appear in the parameter field on DirectSOFT 5screens.
DL430 Range
DL440 Range aaa aaa
DL450 Range aaa
----
(See DirectSOFT Manual)
(See DirectSOFT Manual)
At first glance you may wonder why the instructions work differently in the two different programming tools. In reality, the instructions do not work differently. In DirectSOFT, the 40--characters are actually broken down into multiple ACONs that contain 2 characters each when it is downloaded to the CPU. So, if you create the program with the software, and you examine the program mnemonics with a handheld (or even with DirectSOFT), you would see multiple ACONs that contain 2 characters each. Examples are shown on the following pages.
DL405 User Manual, 4th Edition
Page 369
Standard RLL Instructions Message Instructions
Numeric Constant (NCON)
430 440 450
DS
HPP
The Numeric Constant instruction is used with the DLBL instruction to store the HEX ASCII equivalent of numeric data for use with other instructions. Two digits can be stored in an NCON instruction.
Operand Data Type
Constant
Using the Instructions to Build the Messages
DL440 Range
K
NCON K aaa
DL450 Range aaa aaa
0--FFFF
0--FFFF
The Fault instruction actually copies the messages into the appropriate Error table. However, it is important to understand how the DLBL, ACON, and NCON instructions are combined to build the message. The DLBL is placed after the END instruction, which signifies the end of the main program. The ACON and NCON instructions are placed within the DLBL area. The diagram shows an example.
5--197
DirectSOFTDisplay
END DLBL K1 ACON CHECK CLAMP
History (HISTRY)
The History instruction stores event history information in memory of the PLC.
HISTRY A aaa
430 440 450
DS
HPP
Standard RLL Instructions
DL405 User Manual, 4th Edition
Page 370
5--198
Standard RLL Instructions Message Instructions
Important Information about FAULT Execution
It is important to understand how the Error Message and Error Code tables work when the Fault instruction is executed. Each time the instruction is executed, the code or message is inserted into the table. Since the CPU scan is extremely fast, then it is easily possible to completely fill up a table with a single message. In many cases this is not desirable, since it’s nice to maintain a history of the errors. (That’s why there are 32 positions in the Error Code table and 16 positions in the Error Message table.) For example, let’s say you are examining a limit switch (X1). When the switch is closed, you want an error message (CHECK CLAMP 10) to be logged into the Error Message table. In the real world, the limit switch may be closed for several seconds (or minutes, or hours...). During this time, the CPU will execute the Fault instruction a number of times, so the entire Error Message table will be full of a single message. How do you solve this problem? Simple. Instead of using the limit switch to trigger the Fault instruction, use the limit switch to trigger a control relay used as a one-shot (PD coil instruction). Then, use the control relay as the input to the Fault instruction. Since the Fault is now triggered by the PD, which is only on for one scan, the message will only be copied into the table one time. This keeps the history of older messages intact.
DirectSOFT C0
X1
PD When X1 is on, turn on C0 for one scan.
C0
FAULT K1 When C0 is on, the FAULT instruction copies the message built by the ACONs and NCONs following DLBL K1 into the Error tables.
END DLBL K1 ACON CHECK CLAMP 10
Standard RLL Instructions
NOTE: This method does not work correctly with a handheld programmer. The message will never appear on the display. You must use the input contact (X1 in this example) to trigger the Fault instruction directly. The diagram shown here provides an example.
DirectSOFT
X1
FAULT K1 When X1 is on, the FAULT instruction copies the message built by the ACONs and NCONs following DLBL K1 into the Error tables.
END DLBL K1 ACON CHECK CLAMP 10
DL405 User Manual, 4th Edition
Page 371
Standard RLL Instructions Message Instructions
Obviously, you could combine other instructions with the PD instruction usage to develop logic that would work for both the handheld programmer and DirectSOFT. For example, if it’s possible in your application, you can have two input contacts that can trigger the FAULT instruction. Consider the example shown to the right. If X1 comes on, then the message will only be copied into the table one time. You could see the message with DirectSOFT, but you would not automatically see it on the handheld programmer display. If X2 comes on, then the message would probably fill the entire table. Also, it would automatically appear on the handheld programmer.
5--199
DirectSOFTDisplay C0
X1
PD When X1 is on, turn on C0 for one scan.
C0
FAULT K1
X2
When C0 is on, the FAULT instruction copies the message built by the ACONs and NCONs following DLBL K1 into the Error tables.
END DLBL K1 ACON CHECK CLAMP 10
DirectSOFT Example
Since you can enter more characters in an ACON instruction in DirectSOFT, it is very easy to build the entire message in one ACON instruction.
DirectSOFT
PD C0 triggers one entry into the table C0
X1
PD When X1 is on, turn on C0 for one scan.
C0
FAULT K1 When C0 is on, the FAULT instruction copies the message built by the ACONs and NCONs following DLBL K1 into the Error tables.
END DLBL K1
Standard RLL Instructions
ACON CHECK CLAMP 10
DL405 User Manual, 4th Edition
Page 372
5--200
Standard RLL Instructions Message Instructions Since you can only enter two characters per ACON with the handheld programmer, the program appears to be longer to get the same results. You’ll also notice that we’ve organized the ACON contents slightly differently. For example, we’ve only included the character “C” in the first ACON. We have to do it this way in order to get the message to appear correctly. (Remember, a single character entered in an ACON with a handheld will have a blank space preceding it. So if your messages do not contain an even number of characters, you may have to play around with them to get the spacing just right.) Also, we have to use X1 to directly trigger the FAULT instruction. Otherwise, the message will never automatically appear on the handheld programmer display.
Handheld Programmer Example
Message appears on handheld display X1
FAULT K1 When X1 is on, the FAULT instruction copies the message built by the ACONs and NCONs following DLBL K1 into the Error tables.
Asterisk (*) is automatically provided by the handheld operating system. It does not have to be entered with an ACON.
* CHECK CL AMP 1 0 I I I I I I I I 7 6 5 4 3 2 10 7 6 5 4 3 2 10
END DLBL K1 ACON C Handheld Programmer Keystrokes
ACON HE ACON CK
1
SHFT
F
A
U
L
T
SHFT
K(CON)
SHFT
D
L
B
L
SHFT
K(CON)
1
SHFT
A
C
O
N
ASC
SHFT
C
SHFT
A
C
O
N
ASC
SHFT
H
E
SHFT
A
C
O
N
ASC
SHFT
C
K
SHFT
A
C
O
N
ASC
SHFT
C
SHFT
A
C
O
N
ASC
SHFT
L
A
SHFT
A
C
O
N
ASC
SHFT
M
P
SHFT
A
C
O
N
ASC
1
0
1
END C
ACON LA ACON MP ACON 10
Standard RLL Instructions
X(IN)
S S
ACON
Clearing the Messages
STR
You use different methods to clear the System Errors vs. the Fault Messages. S System Errors, initialize the CPU’s scratchpad memory S Fault Message Table, clear the CPU program memory WARNING: If you initialize the scratchpad, you will also remove any retentive memory ranges that you may have changed.
DL405 User Manual, 4th Edition