The text of a manual · part 26 of 40
DL05 Micro PLC User Manual, Volume 1 of 2: Chapter 5: Standard RLL and Intelligent Box Instructions, pages 234 to 243
Pages 234 to 243 of 379, from DL05 Micro PLC User Manual, Volume 1 of 2
The original document is the PDF (5.8 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 D0-05AA
Page 234
Chapter 5: Standard RLL - Message Instructions
Message Instructions DS5
1 Fault (FAULT) 2 The Fault instruction is used to display a message on the handheld programmer or in the DirectSOFT 5 status bar. The message has a maximum of 23 characters and can be either V-memory data, 3 numerical constant data or ASCII text. To display the value in a V-memory location, specify the V-memory location in the 4 instruction. To display the data in ACON (ASCII constant) or NCON (Numerical constant) instructions, specify the constant (K) value for the corresponding data label area. 5 Operand Data Type DL05 Range aaa 6 7 Discrete Bit Flags Description 8 9 Fault Example In the following example when X1 is on, the message SW 146 will display on the handheld programmer. 10 The NCONs use the HEX ASCII equivalent of the text to be displayed. (The HEX ASCII for a blank is 11 20, a 1 is 31, 4 is 34 ...) 12 13 14 A B C D Used
HPP
FAULT A aaa
Used
....................................A V-memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . V Constant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . K
SP50
DS5
Used
HPP
Used
On when the FAULT instruction is executed
FAULT : *SW 146
DirectSOFT 5 Direct SOFT32 X1
See memory map 1-FFFF
Handheld Programmer Keystrokes B
$
FAULT K1
STR
1
SHFT
F
SHFT
E
SHFT
D
SHFT
A
SHFT
N TMR
C
SHFT
N TMR
C
A
ENT
U ISG
5
0
N TMR
D
4
B
3
L ANDST C
L ANDST
T MLR
B
1
ENT
END
DLBL
K1
ACON A SW
NCON K 2031
0
3
ENT
B
1
L ANDST N TMR
S
2
O INST#
2
O INST#
N TMR
O INST#
N TMR
D
2
1
ENT
RST
W ANDN
ENT
C
A
D
2
0
E
3
B
3
D
4
1
G
3
6
ENT ENT
NCON K 3436
DL05 Micro PLC User Manual, 6th Edition, Rev. A
5–111
Page 235
Chapter 5: Standard RLL - Message Instructions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Data Label (DLBL) DS5
Used
HPP
Used
The Data Label instruction marks the beginning of an ASCII/numeric data area. 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. Operand Data Type ....................................A Constant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . K
DLBL
K aaa
DL05 Range aaa 1-FFFF
ASCII Constant (ACON) DS5
Used
HPP
Used
The ASCII Constant instruction is used with the DLBL instruction to store ASCII text for use with other instructions. Two ASCII characters can be stored in an ACON instruction. If only one character is stored in an ACON a leading space will be inserted. Operand Data Type
ACON A aaa
DL05 Range aaa
Constant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A
0-9 A-Z
Numerical Constant (NCON) DS5
Used
HPP
Used
5–112
The Numerical Constant instruction is used with the DLBL instruction to store the HEX ASCII equivalent of numerical data for use with other instructions. Two digits can be stored in an NCON instruction. Operand Data Type
NCON K aaa
DL05 Range aaa
Constant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . K
DL05 Micro PLC User Manual, 6th Edition, Rev. A
0-FFFF
Page 236
Chapter 5: Standard RLL - Message Instructions
Data Label Example In the following example, an ACON and two NCON instructions are used within a DLBL instruction to build a text message. See the FAULT instruction for information on displaying messages. The DV-1000 Manual also has information on displaying messages. DirectSOFT 5 Direct SOFT32
END
DLBL K1
ACON A SW
NCON K 2031
NCON K 3436
Handheld Programmer Keystrokes
SHFT
E
N TMR
D
4
SHFT
D
L ANDST
B 1
L ANDST
B
3
SHFT
A
C 2
O INST#
N TMR
S RST
W ANDN
ENT
SHFT
N TMR
C
O INST#
N TMR
C
A
D
2
SHFT
N TMR
C
O INST#
N TMR
D
2
0
3
ENT
1
ENT
2
0 E
3
B 3
D 4
1 G
3
6
ENT ENT
DL05 Micro PLC User Manual, 6th Edition, Rev. A
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
5–113
Page 237
Chapter 5: Standard RLL - Message Instructions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Print Message (PRINT) DS5
Used
HPP
N/A
5–114
The Print Message instruction prints the embedded text or text/data variable message to the specified, configured, communications port (Port 2 on the DL05 CPU). Operand Data Type ....................................A Constant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . K
A aaa
“Hello, this is a PLC message”
DL05 Range aaa 2
You may recall from the CPU specifications in Chapter 4 that the DL05’s ports are capable of several protocols. Port 1 cannot be configured for the non-sequence protocol. To configure port 2 using the Handheld Programmer, use AUX 56 and follow the prompts, making the same choices as indicated below on this page. To configure a port in DirectSOFT 5, choose the PLC > Setup > Setup Secondary Comm Port. • Port: From the port number list box at the top, choose “Port 2”. • Protocol: Click the check box to the left of “Non-sequence”, and then you’ll see the dialog box shown below.
• Baud Rate: Choose the baud rate that matches your printer. • Stop Bits, Parity: Choose number of stop bits and parity setting to match your printer. • Memory Address: Choose a V-memory address to be used by DirectSOFT 5 to store the port setup information. You will need to reserve 9 words in V-memory for this purpose. NOTE: See Chapter 4 for a detail of the non-sequence setup.
Then click the button indicated to send the Port 2 configuration to the CPU, and click Close. Then see Chapter 3 for port wiring information, in order to connect your printer to the DL05.
DL05 Micro PLC User Manual, 6th Edition, Rev. A
Page 238
Chapter 5: Standard RLL - Message Instructions Port 2 on the DL05 has standard RS232 levels, and should work with most printer serial input connections. Text element – this is used for printing character strings. The character strings are defined as the character (more than 0) ranged by the double quotation marks. Two hex numbers preceded by the dollar sign means an 8-bit ASCII character code. Also, two characters preceded by the dollar sign is interpreted according to the following table:
1 2 3 # Character code Description 4 5 6 The following examples show various syntax conventions and the length of the output to the 7 printer. Example: 8 ”” Length 0 without character 9 ”A” Length 1 with character A ”” Length 1 with blank 10 ” $” ” Length 1 with double quotation mark ”$R$L” Length 2 with one CR and one LF 11 ”$0D$0A” Length 2 with one CR and one LF ”$$” Length 1 with one $ mark 12 In printing an ordinary line of text, you will need to include double quotation marks before and after the text string. Error code 499 will occur in the CPU when the print instruction 13 contains invalid text or no quotations. It is important to test your PRINT instruction data during the application development. 14 The following example prints the message to port 2. We use a PD contact, which causes the message instruction to be active for just one scan. Note the $N at the end of the message, which produces a carriage return / line feed on the printer. This prepares the printer to print A the next line, starting from the left margin. B X1 PRINT K2 Print the message to Port 2 when X1 makes an off-to-on transition. “Hello, this is a PLC message.$N” C D 1 2 3 4 5 6 7
$$ $” $L or $l $N or $n $P or $p $R or $r $T or $t
Dollar sign ($) Double quotation (”) Line feed (LF) Carriage return line feed (CRLF) Form feed Carriage return (CR) Tab
DL05 Micro PLC User Manual, 6th Edition, Rev. A
5–115
Page 239
Chapter 5: Standard RLL - Message Instructions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D 5–116
V-memory element - this is used for printing V-memory contents in the integer format or real format. Use V-memory number or V-memory number with “-” and data type. The data types are shown in the table below. The Character code must be capital letters. NOTE: There must be a space entered before and after the V-memory address to separate it from the text string. Failure to do this will result in an error code 499.
#
Character code
Description
1 2 3 4 none :B :D :DB
16-bit binary (decimal number) 4 digit BCD 32-bit binary (decimal number) 8 digit BCD
Example: V2000 Print binary data in V2000 for decimal number V2000 : B Print BCD data in V2000 V2000 : D Print binary number in V2000 and V2001 for decimal number V2000 : D B Print BCD data in V2000 and V2001 Example: The following example prints a message containing text and a variable. The “reactor temperature” labels the data, which is at V2000. You can use the : B qualifier after the V2000 if the data is in BCD format, for example. The final string adds the units of degrees to the line of text, and the $N adds a carriage return / line feed. X1
PRINT K2 “Reactor temperature = ” V2000 “deg. $N” ⊥ ⊥ Message will read: Reactor temperature = 0156 deg
Print the message to Port 2 when X1 makes an off-to-on transition. ⊥ represents a space
V-memory text element ¨This is used for printing text stored in V-memory. Use the % followed by the number of characters after V-memory number for representing the text. If you assign “0” as the number of characters, the print function will read the character count from the first location. Then it will start at the next V-memory location and read that number of ASCII codes for the text from memory. Example: V2000 % 16 16 characters in V2000 to V2007 are printed. V2000 % 0 The characters in V2001 to Vxxxx (determined by the number in V2000) will be printed.
DL05 Micro PLC User Manual, 6th Edition, Rev. A
Page 240
Chapter 5: Standard RLL - Message Instructions Bit element – this is used for printing the state of the designated bit in V-memory or a relay bit. The bit element can be assigned by the designating point (.) and bit number preceded by the V-memory number or relay number. The output type is described as shown in the table below. #
Data format
Description
1 none
2
: BOOL
3
: ONOFF
Print 1 for an ON state, and 0 for an OFF state Print “TRUE” for an ON state, and “FALSE” for an OFF state Print “ON” for an ON state, and “OFF” for an OFF state
Example: V2000 . 15
Prints the status of bit 15 in V2000, in 1/0 format
C100
Prints the status of C100 in 1/0 format
C100 : BOOL
Prints the status of C100 in TRUE/FALSE format
C100 : ON/OFF
Prints the status of C00 in ON/OFF format
V2000.15 : BOOL Prints the status of bit 15 in V2000 in TRUE/FALSE format The maximum numbers of characters you can print is 128. The number of characters for each element is listed in the table below: Element Type
Maximum Characters
Text, 1 character 16 bit binary 32 bit binary 4 digit BCD 8 digit BCD Floating point (real number) Floating point (real with exponent) V-memory/text Bit (1/0 format) Bit (TRUE/FALSE format) Bit (ON/OFF format)
1 6 11 4 8 12 12 2 1 5 3
The handheld programmer’s mnemonic is “PRINT,” followed by the DEF field. Special relay flags SP116 and SP117 indicate the status of the DL05 CPU ports (busy, or communications error). See the appendix on special relays for a description. NOTE: You must use the appropriate special relay in conjunction with the PRINT command to ensure the ladder program does not try to PRINT to a port that is still busy from a previous PRINT or WX or RX instruction.
DL05 Micro PLC User Manual, 6th Edition, Rev. A
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
5–117
Page 241
Chapter 5: Standard RLL - Intelligent I/O Instructions
1 Intelligent I/O Instructions Read from Intelligent Module (RD) 2 The Read from Intelligent Module instruction reads a block of data (1-128 bytes maximum) from an intelligent I/O module into the CPU’s V-memory. It loads the function parameters into 3 the first and second level of the accumulator stack and the accumulator by three additional instructions. 4 Listed below are the steps to program the Read from Intelligent module function. Step 1: 앥 Load the base number (0-3) into the first byte and the slot number (0-7) into the 5 second byte of the second level of the accumulator stack. Step 2: 앥 Load the number of bytes to be transferred into the first level of the accumulator 6 stack (maximum of 128 bytes). Step 3: 앥 Load the address from which the data will be read into the accumulator. This 7 parameter must be a HEX value. Step 4: 앥 Insert the RD instruction which specifies the starting V-memory location (Vaaa) 8 where the data will be read into. Helpful Hint: 앥 Use the LDA instruction to convert an octal address to its HEX equivalent 9 and load it into the accumulator when the HEX format is required. Operand Data Type DL06 Range 10 aaa 11 Discrete Bit Flags Description 12 NOTE: Status flags are valid only until another instruction uses the same flag. In the following example when X1 is ON, the RD instruction will read six bytes of data from 13 a intelligent module in base 1, slot 2 starting at address 0 in the intelligent module and copy the information into V-memory loacations V1400-V1402. 14 A } B C D DS32
Used
HPP
Used
RD
V aaa
V-memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . V
SP54
See memory map
On when RX, WX RD, WT instructions are executed with the wrong parameters.
X1
LD
K0102
LD
K6
LD
K0
RD
V1400
5–118
Intelligent Module
CPU
Direct SOFT 5
Data
The constant value K0102 specifies the base number (01) and the base slot number (02). The constant value K6 specifies the number of bytes to be read.
The constant value K0 specifies the starting address in the intelligent module.
V1400 is the starting location in the CPU where the specified data will be stored.
V1400
3
4
1
2
V1401
7
8
5
6
V1402
0
1
9
0
V1403
X
X
X
X
V1404
X
X
X
X
{
12
Address 0
34
Address 1
56
Address 2
78
Address 3
90
Address 4
01
Address 5
Handheld Programmer Keystrokes $
B
STR
SHFT
L ANDST
D
SHFT
L ANDST
D
SHFT
L ANDST
D
SHFT
R ORN
D
DL05 Micro PLC User Manual, 6th Edition, Rev. A
1
3 3 3
3
ENT
PREV
A
PREV
G
PREV B
1
A E
0
6
0 4
B
1
A
0
C
2
ENT
ENT A
0
A
0
ENT
ENT
Page 242
Chapter 5: Standard RLL - Intelligent I/O Instructions
Write to Intelligent Module (WT) DS32 HPP
1 2 3 4 5 6 7 8 9 aaa 10 Discrete Bit Flags Description 11 NOTE: Status flags are valid only until another instruction uses the same flag. 12 In the following example, when X1 is on, the WT instruction will write six bytes of data to an 13 intelligent module in base 1, slot 2 starting at address 0 in the intelligent module and copy the data from V-memory locations V1400-V1402. 14 A } B C D
The Write to Intelligent Module instruction writes a block of data (1-128 bytes maximum) to an intelligent I/O module WT Used from a block of V-memory in the CPU. The function V aaa 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 to program the Read from Intelligent module function. Step 1: 앥 Load the base number (0-3) into the first byte and the slot number (0-7) into the second byte of the second level of the accumulator stack. Step 2: 앥 Load the number of bytes to be transferred into the first level of the accumulator stack (maximum of 128 bytes). Step 3: 앥 Load the intelligent module address which will receive the data into the accumulator. This parameter must be a HEX value. Step 4: 앥 Insert the WT instruction which specifies the starting V-memory location (Vaaa) where the data will be written from in the CPU. Helpful Hint: 앥 Use the LDA instruction to convert an octal address to its HEX equivalent and load it into the accumulator when the HEX format is required. Operand Data Type DL06 Range Used
V-memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . V
SP54
See memory map
On when RX, WX RD, WT instructions are executed with the wrong parameters.
Intelligent Module
CPU
Data
Direct SOFT 5 X1
LD
K0102
LD
K6
LD
K0
WT
V1400
The constant value K0102 specifies the base number (01) and the base slot number (02). The constant value K6 specifies the number of bytes to be written.
The constant value K0 specifies the starting address in the intelligent module.
V1400 is the starting location in the CPU where the specified data will be written from.
V1377
X
X
X
X
V1400
3
4
1
2
V1401
7
8
5
6
V1402
0
1
9
0
V1403
X
X
X
X
V1404
X
X
X
X
{
12
Address 0
34
Address 1
56
Address 2
78
Address 3
90
Address 4
01
Address 5
Handheld Programmer Keystrokes $
B
STR
SHFT
L ANDST
D
SHFT
L ANDST
D
SHFT
L ANDST
D
SHFT
W ANDN
T
1
3 3 3
MLR
ENT
PREV
A
PREV
G
PREV B
1
A E
0
6
0 4
B
1
A
0
C
2
ENT
ENT
ENT A
0
A
0
DL05 Micro PLC User Manual, 6th Edition, Rev. A
ENT
5–119
Page 243
Chapter 5: Standard RLL - Network Instructions
1 Network Instructions Read from Network (RX) 2 The Read from Network instruction causes the master device on a network to read a block of data from a slave device on the same network. The function parameters are loaded into the accumulator 3 and the first and second level of the stack. Listed below are the program steps necessary to execute the Read from Network 4 function. Step 1:, Load the slave address (0–90 BCD) into the low byte and “F2” into the high byte 5 of the accumulator (the next two instructions push this word down to the second layer of the stack). 6 Step 2:, Load the number of bytes to be transferred into the accumulator, 2 - 128 bytes are allowed, (the next instruction pushes this word onto the top of the stack). 7 Step 3:, Load the starting Master CPU address into the accumulator. This is the memory location where the data read from the slave will be put. This parameter requires a HEX value. 8 Step 4:, Insert the RX instruction which specifies the starting V-memory location (Aaaa) where the data will be read from in the slave. Helpful Hint: For parameters that require HEX values, the LDA instruction can be used to 9 convert an octal address to the HEX equivalent and load the value into the accumulator. 10 Operand Data Type DL05 Range A aaa 11 12 13 14 A B C D DS5
Used
HPP
Used
RX
A aaa
V-memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . V Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . P Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . X Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Y Control Relays . . . . . . . . . . . . . . . . . . . . . . . . . . C Stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . S Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . T Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . CT Special Relay . . . . . . . . . . . . . . . . . . . . . . . . . . SP Program Memory . . . . . . . . . . . . . . . . . . . . . . . $
5–120
DL05 Micro PLC User Manual, 6th Edition, Rev. A
All (See page 3–28) All V-memory. (See page 3–28) 0–377 0–377 0–777 0–377 0–177 0–177 0–777 0–2047 (2K program mem.)