Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeContact

The text of a manual · part 43 of 60

DL205 PLC User Manual, Volume 1 of 2, pages 421 to 430

Pages 421 to 430 of 598

The original document is the PDF (12 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 D2-04TD1, AutomationDirect D2-08TD2, AutomationDirect D2-16ND3-2, AutomationDirect D2-32ND3, Konnect-It D2-04TD1, Koyo D2-04TD1, Konnect-It D2-08TD2, Koyo D2-08TD2, and 5 more models

Page 421

Chapter 5: Standard RLL Instructions

Message Instructions

1 The Fault instruction is used to display a message on the 2 handheld programmer or DirectSOFT. The message has a maximum of 23 characters and can be either V-memory data, numerical constant data, or ASCII text. See Appendix G for the 3 ASCII Conversion Table. To display the value in a V-memory location, specify the 4 V-memory location in the instruction. To display the data in ACON (ASCII constant) or NCON (Numerical constant) 5 instructions, specify the constant (K) value for the corresponding data label area. 6 Operand Data Type DL240 Range DL250-1 Range DL260 Range A aaa aaa aaa 7 8 NOTE: The FAULT instruction takes a considerable amount of time to execute. This is because the FAULT parameters are stored in EEPROM. Make sure you consider the instruction execution times (shown in 9 Appendix C) if you are attempting to use the FAULT instructions in applications that require faster than normal execution cycles. 10 11 12 13 14 A B C D

Fault (FAULT)

230 240 250-1 260 DS Used HPP Used

FAULT A aaa

V-memory Constant.

V K

All (See page 3-54) 1-FFFF

All (See page 3-55) 1-FFFF

All (See page 3-56) 1-FFFF

DL205 User Manual, 4th Edition, Rev. D

5-197

Page 422

Chapter 5: Standard RLL Instructions

In the following example, when X1 is on, the message SW 146 will display on the handheld programmer. The NCONs use the HEX ASCII equivalent of the text to be displayed. (The HEX ASCII for a blank is 20, a 1 is 31, 4 is 34 ...) DirectSOFT X1

FAULT K1

SW 146

END

DLBL K1

ACON A SW

NCON K 2031

NCON K 3436

Handheld Programmer Keystrokes $

B

STR

SHFT

F

5

A

1 0

ENT U

ISG

L ANDST

T MLR

B

5-198

1

ENT

SHFT

E

SHFT

D

4

N TMR

D

3

L ANDST

B

C

SHFT

A

SHFT

N TMR

C

SHFT

N TMR

C

0

3

ENT

1

L ANDST

B

2

O INST#

N TMR

S RST

W ANDN

ENT

2

O INST#

N TMR

C

A

D

2

O INST#

N TMR

D

1

2 3

Instructions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D

Fault Example

DL205 User Manual, 4th Edition, Rev. D

ENT

E

0 4

D

3 3

B G

1 6

ENT ENT

Page 423

Chapter 5: Standard RLL Instructions

Data Label (DLBL) The Data Label instruction marks the beginning of an

230 ASCII / numeric data area. DLBLs are programmed 240 after the End statement. A maximum of 64 (DL240 and 250-1 DL250–1/260) or 32 (DL230) DLBL instructions can be 260 used in a program. Multiple NCONs and ACONs can be

DLBL K aaa used in a DLBL area.

Operand Data Type Constant

K

DL230 Range

DL240 Range

DL250-1 Range aaa aaa aaa

DL260 Range aaa

1-FFFF

1-FFFF

1-FFFF

1-FFFF

ASCII Constant (ACON) ASCII Constant instruction is used with the DLBL 230 The instruction to store ASCII text for use with other 240 instructions. Two ASCII characters can be stored in an 250-1 ACON instruction. If only one character is stored in 260 an ACON, a leading space will be printed in the Fault message. Operand Data Type

ASCII

A

DL230 Range

DL240 Range

ACON A aaa

DL250-1 Range

DL260 Range aaa aaa aaa aaa

0-9 A-Z

0-9 A-Z

0-9 A-Z

0-9 A-Z

Numerical Constant (NCON) The Numerical Constant instruction is used with the

DLBL instruction to store the HEX ASCII equivalent of 240 numerical data for use with other instructions. Two digits 250-1 can be stored in an NCON instruction. 260 230

Operand Data Type Constant

K

NCON K aaa

DL230 Range

DL240 Range

DL250-1 Range aaa aaa aaa

DL260 Range aaa

0-FFFF

0-FFFF

0-FFFF

0-FFFF

DS Used HPP Used

DL205 User Manual, 4th Edition, Rev. D

1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D

5-199

Page 424

Chapter 5: Standard RLL Instructions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D 5-200

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. DirectSOFT

END

DLBL K1

ACON A SW

NCON K 2031

NCON K 3436

Handheld Programmer Keystrokes SHFT

E

4

N TMR

D

SHFT

D

3

L ANDST

B

1

L ANDST

B

SHFT

A

C

2

O INST#

N TMR

S RST

W ANDN

ENT

SHFT

N TMR

C

2

O INST#

N TMR

C

A

D

SHFT

N TMR

C

2

O INST#

N TMR

D

0

3

ENT

DL205 User Manual, 4th Edition, Rev. D

1

2 3

ENT

E

0 4

D

3 3

B G

1 6

ENT ENT

Page 425

Chapter 5: Standard RLL Instructions

Print Message (PRINT)

1 2 Data Type DL250-1 Range DL260 Range 3 A aaa aaa 4 You may recall from the CPU specifications in Chapter 3 that the DL250–1 and DL260 ports are capable of several protocols. To configure a port using the Handheld Programmer, use 5 AUX 56 and follow the prompts, making the same choices as indicated below on this page. To configure a port in DirectSOFT, choose the PLC menu, then Setup, then Setup Secondary 6 Comm Port. •P ort: From the port number list box at the top, choose “Port 2.” 7 •P rotocol: Click the check box to the left of “Non-sequence.” The Setup Communication Ports dialog box opens. 8 9 10 11 12 13 14 • Address: Choose a V-memory address for DirectSOFT to use to store the port setup A information. You will need to reserve 66 contiguous words in V-memory for this purpose. Select “Use for printing only” if it applies. • Rate: Choose the baud rate that matches your printer. B • Bits, Parity: Choose number of stop bits and parity setting to match your printer. Then click the button indicated to send the Port 2 configuration to the CPU, and click C Close. See Chapter 3 for port wiring information to connect your printer to the DL2501/260. D

Print Message instruction prints the embedded 230 The text or text/data variable message to the specified 240 communications port (2 on the DL250–1/260 CPU), 250-1 which must have the communications port configured. 260 DS Used HPP N/A

Constant

K

2

PRINT

A aaa

“Hello, this is a PLC message”

2

DL205 User Manual, 4th Edition, Rev. D

5-201

Page 426

Chapter 5: Standard RLL Instructions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D 5-202

Port 2 on the DL250–1/260 has standard RS232 levels, and should work with most printer serial input connections. Text element - 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: #

Character code

Description

1 2 3 4 5 6 7

$$ $” $L or $1 $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

The following examples show various syntax conventions and the length of the output to the printer. Example: ” ” Length 0 without character ”A” Length 1 with character A ” ” Length 1 with blank ” $” ” Length 1 with double quotation mark ” $ R $ L ” Length 2 with one CR and one LF ” $ 0 D $ 0 A ” Length 2 with one CR and one LF ” $ $ ” Length 1 with one $ mark 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 contains invalid text or no quotations. It is important to test your PRINT instruction data during the application development. 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 the next line, starting from the left margin. X1

PRINT K2 “Hello, this is a PLC message.$N”

DL205 User Manual, 4th Edition, Rev. D

Print the message to Port 2 when X1 makes an off-to-on transition.

Page 427

Chapter 5: Standard RLL Instructions V-memory element – 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.

1 NOTE: There must be a space entered before and after the V-memory address to separate it from the text 2 string. Failure to do this will result in an error code 499. # Character code Description 3 4 5 6 Example: V2000 Print binary data in V2000 for decimal number 7 V2000 : B Print BCD data in V2000 V2000 : D Print binary number in V2000 and V2001 for decimal number 8 V2000 : D B Print BCD data in V2000 and V2001 V2000 : R Print floating point number in V2000/V2001 as real number 9 V2000 : E Print floating point number in V2000/V2001 as real number with exponent 10 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 11 of text, and the $N adds a carriage return / line feed. 12 13 14 V-memory text element – 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 A “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 B codes for the text from memory. Example: C V2000 % 16 16 characters in V2000 to V2007 are printed. V2000 % 0 The characters in V2001 to Vxxxx (determined by the number in D

V2000) will be printed. 1 2 3 4 5 6

X1 none :B :D :DB :R :E

16-bit binary (decimal number) 4-digit BCD 32-bit binary (decimal number) 8-digit BCD Floating point number (real number) Floating point number (real number with exponent)

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

DL205 User Manual, 4th Edition, Rev. D

5-203

Page 428

Chapter 5: Standard RLL Instructions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D 5-204

Bit element – 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 2 3 none : BOOL : 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 C100 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 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)

Maximum Characters 1 6 11 4 8 13 13 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 DL250–1/260 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.

DL205 User Manual, 4th Edition, Rev. D

Page 429

Chapter 5: Standard RLL Instructions

Modbus RTU Instructions (DL260)

1 The Modbus Read from Network (MRX) instruction is used by the DL260 network master to read a block of data from a connected slave device and to write the data into V–memory 2 addresses within the master. The instruction allows the user to specify the Modbus Function Code, slave station address, starting master and slave memory addresses, number of elements to 3 transfer, Modbus data format and the Exception Response Buffer. 4 5 6 7 8 9 10 •P ort Number: must be DL260 Port 2 (K2) 11 •S lave Address: specify a slave station address (1 to 247) •F unction Code: The following Modbus function codes are supported by the MRX instruction: 12 01 – Read a group of coils 02 – Read a group of inputs 13 03 – Read holding registers 04 – Read input registers 14 07 – Read Exception status •S tart Slave Memory Address: specifies the starting slave memory address of the data to be read. See A the table on the following page. •S tart Master Memory Address: specifies the starting memory address in the master where the data B will be placed. See the table on the following page. •N umber of Elements: specifies how many coils, inputs, holding registers or input registers will be read. See the table on the following page. C •M odbus Data Format: specifies Modbus 584/984 or 484 data format to be used. D

Modbus Read from Network (MRX)

230 240 250-1 260 DS Used HPP N/A

DL205 User Manual, 4th Edition, Rev. D

5-205

Page 430

Chapter 5: Standard RLL Instructions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D 5-206

•E xception Response Buffer: specifies the master memory address where the Exception Response will be placed (6 bytes in length). See the table on the following page. The exception response buffer uses 3 words. These bytes are swapped in the MRX/MWX exception response buffer V-memory so: V-Memory 1 Hi Byte = Function Code Byte (Most Significant Bit Set) V-Memory 1 Lo Byte = Address Byte V-Memory 2 Hi Byte = One of the CRC Bytes V-Memory 2 Lo Byte = Exception Code V-Memory 3 Hi Byte = 0 V-Memory 3 Lo Byte = Other CRC Byte

MRX Slave Memory Address MRX Slave Address Ranges Function Code

Modbus Data Format

Slave Address Range(s)

01-Read Coil 01-Read Coil 02-Read Input Status

484 Mode 584/984 Mode 484 Mode

02-Read Input Status

584/984 Mode

03-Read Holding Register

484 Mode

03-Read Holding Register

584/984

04-Read Input Register

484 Mode

04-Read Input Register

584/984 Mode

07-Read Exception Status

484 and 584/984 Mode

1-999 1-65535 1001-1999 10001-19999 (5 digit) or 100001165535 (6 digit) 4001-4999 40001-49999 9 (5 digit) or 4000001-465535 (6 digit) 3001-3999 30001-39999 (5 digit) or 3000001365535 (6 digit) n/a

MRX Master Memory Addresses MRX Master Memory Address Ranges Operand Data Type Inputs Outputs Control Relays Stage Bits Timer Bits Counter Bits Special Relays V-memory Global Inputs Global Outputs

DL260 Range X Y C S T CT SP V GX GY

0-1777 0-1777 0-3777 0-1777 0-377 0-377 0-777 all (see page 3-56) 0-3777 0-3777

DL205 User Manual, 4th Edition, Rev. D