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

The text of a manual · part 47 of 61

DL205 PLC User Manual, Volume 1 of 2: Chapter 5: RLL and Intelligent Box Instructions, pages 443 to 452

Pages 443 to 452 of 592, from DL205 PLC User Manual, Volume 1 of 2

The original document is the PDF (13 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 PLC Direct D2-08ND3 and Koyo D2-08ND3

Page 443

Chapter 5: Standard RLL Instructions - ASCII

ASCII Compare (CMPV) ASCII Compare instruction compares two groups of V–memory registers. The CMPV 230 The will compare any data type (ASCII to ASCII, BCD to BCD, etc.) of one series (group) of 240 V–memory registers to another series of V–memory registers for a specified byte length. 250-1 “Compare from” Starting Address: 260 specifies the begining V–memory register DS Used HPP N/A of the first group of V–memory registers to be compared from. “Compare to” Starting Address: specifies the begining V–memory register of the second group of V–memory registers to be compared to. Number of Bytes: specifies the length of each V–memory group to be compared SP61 = 1 (ON), the result is equal SP61 = 0 (OFF), the result is not equal Parameter

All V-memory (See page 3 - 56) All V-memory (See page 3 - 56)

Number of Bytes

All V-memory (See page 3 - 56) or K0-127

Discrete Bit Flags SP53 SP61 SP71

DL260 Range

Compare from Starting Address Compare to Starting Address

Description On if the CPU cannot execute the instruction. On when result is equal. On when a value used by the instruction is invalid.

CMPV Example The CMPV instruction executes when the AIN instruction is complete. If the compared V–memory tables are equal, SP61 will turn ON. AIN Complete C1

CMPV "Compare from" Starting Address: V3400 "Compare to" Starting Address: V3500 Number of Bytes: K12

SP61

Strings are equal C11 OUT

DL205 User Manual, 4th Edition, Rev. A

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

5–221

Page 444

Chapter 5: Standard RLL Instructions - ASCII

ASCII Print to V-memory (VPRINT)

ASCII Print to V–memory instruction will write a specified ASCII string into a series of 1 The V–memory registers. Other features include Byte Swap, options to suppress or convert leading zeros or spaces, and _Date and _Time options for U.S., European, and Asian date 2 formats and 12 or 24 hour time formats.

• Byte Swap: swaps the high–byte and low–byte within each V–memory register the ASCII 3 string is printed to. See the SWAPB instruction for details. 4 • Print to Starting V–memory Address: specifies the begining of a series of V–memory addresses where the ASCII string will be 5 placed by the VPRINT instruction. • Starting V–memory Address: the first 6 V–memory register of the series of registers specified will contain the ASCII string’s length in bytes. 7 • Starting V–memory Address +1: the 2nd and subsequent registers will contain the ASCII 8 string printed to V–memory. 9 VPRINT Time/Date Stamping Parameter DL260 Range 10 11 Discrete Bit Flags Description 12 13 The codes in the table below can be used in the VPRINT ASCII string message to “print to V–memory” the current time and/or date. 14 # Character Code Date/Time Stamp Options A B C D 230 240

250-1 260

DS Used HPP N/A

Print to Starting V-memory Address

SP53 SP71

On if the CPU cannot execute the instruction. On when a value used by the instruction is invalid.

1 2 3 4 5

5–222

All V-memory (See page 3 - 56)

_Date:us _Date:e _Date:a _Time:12 _Time:24

American standard (month/day/2 digit year) European standard (day/month/2 digit year) Asian standard (2 digit year/month/day) standard 12 hour clock (0-12 hour:min am/pm) standard 24 hour clock (0-23 hour:min am/pm)

DL205 User Manual, 4th Edition, Rev. A

Page 445

Chapter 5: Standard RLL Instructions - ASCII

VPRINT V-memory element The following modifiers can be used in the VPRINT ASCII string message to “print to V–memory” register contents in integer format or real format. Use V-memory number or Vmemory 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

1 2 3 4 5 6 none :B :D :DB :R :E

Description 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)

Examples: 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 V2000 : R Print floating point number in V2000/V2001 as real number V2000 : E Print floating point number in V2000/V2001 as real number with exponent The following modifiers can be added to any of the modifies above to suppress or convert leading zeros or spaces. The character code must be capital letters. #

Character Code

1 2 3

S C0 0

Description Suppresses leading spaces Converts leading spaces to zeros Suppresses leading zeros

Example with V2000 = 0018 (binary format) V-memory Register with Modifier V2000 V2000:B V2000:B0

1 0 0 1

Number of Characters 2 3 0 0 2

1 1

DL205 User Manual, 4th Edition, Rev. A

4 8 2

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

5–223

Page 446

Chapter 5: Standard RLL Instructions - ASCII Example with V2000 = sp sp18 (binary format) where sp = space

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

V-memory Register with Modifier V2000 V2000:B V2000:BS V2000:BC0

1

Number of Characters 2 3 sp sp 1 0 sp sp 2 0

4

1 1

8 2

1

2

VPRINT V-memory text element The following is used for “printing to V-memory” text stored in registers. 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 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.

VPRINT Bit element The following is used for “printing to V–memory” the state of the designated bit in V-memory or a control 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

1 none

2

: BOOL

3

: ONOFF

Example: V2000 . 15 C100 C100 : BOOL C100 : ON/OFF V2000.15 : BOOL

Description 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

Prints the status of bit 15 in V2000, in 1/0 format Prints the status of C100 in 1/0 format Prints the status of C100 in TRUE/FALSE format Prints the status of C100 in ON/OFF format Prints the status of bit 15 in V2000 in TRUE/FALSE format

DL205 User Manual, 4th Edition, Rev. A

Page 447

Chapter 5: Standard RLL Instructions - ASCII The maximum numbers of characters you can VPRINT is 128. The number of characters required for each element, regardless of whether the :S, :C0 or :0 modifiers are used, 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

Text element The following is used for “printing to V-memory” 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

1 2 3 4 5 6 7

$$ $” $L or $l $N or $n $P or $p $R or $r $T or $t

Description Dollar sign ($) Double quotation (“) Line feed (LF) Carriage return line feed (CRLF) Form feed Carriage return (CR) Tab

DL205 User Manual, 4th Edition, Rev. A

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

5–225

Page 448

Chapter 5: Standard RLL Instructions - ASCII

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

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 VPRINT instruction data during the application development.

VPRINT Example Combined with PRINTV Instruction The VPRINT instruction is used to create a string in V–memory. The PRINTV is used to print the string out of port 2. Create string permissive C12 14

VPRINT Byte Swap: “Print to” Address:

All V4000

“STX” V3000:B “$0D” Delay permissive for VPRINT C13 SET Delay Permissive for VPRINT C13 15

TMR Delay for VPRINT to complete T1 K10

Delay for VPRINT to complete T1 16

PRINTV CPU/DCM Slot: Port Number: Start Address: Number of Bytes: Append: Byte Swap: Busy: Complete:

CPU K2 V4000 K12 0D (hexadecimal) None C0 C1

Delay permissive for VPRINT C13 SET

DL205 User Manual, 4th Edition, Rev. A

Page 449

Chapter 5: Standard RLL Instructions - ASCII

ASCII Print from V-memory (PRINTV) The ASCII Print from V–memory instruction will send an ASCII string out of the designated communications port from a specified series of V–memory registers for a specified length in number of bytes. Other features include user specified Append Characters to be placed after the desired data string for devices that require specific termination character(s), Byte Swap options, and user specified flags for Busy and Complete.

230 240 250-1 260

• Port Number: must be DL260 port 2 (K2)

DS Used HPP N/A

• Start Address: specifies the begining of series of V–memory registers that contain the ASCII string to print • Number of Bytes: specifies the length of the string to print • Append Characters: specifies ASCII characters to be added to the end of the string for devices that require specific termination characters • Byte Swap: swaps the high–byte and low–byte within each V–memory register of the string while printing. See the SWAPB instruction for details. • Busy Bit: will be ON while the instruction is printing ASCII data • Complete Bit: will be set once the ASCII data has been printed and reset when the PRINTV instruction permissive bits are disabled.

Parameter Port Number Start Address Number of Bytes Bits: Busy, Complete

Discrete Bit Flags SP53 SP71 SP116 SP117

DL260 Range port 2 (K2) All V-memory (See page 3-56) All V-memory (See page 3-56) or K1-128 C0-3777

Description On if the CPU cannot execute the instruction. On when a value used by the instruction is invalid. On when CPU port 2 is communicating with another device. On when CPU port 2 has experienced a communication error.

See the facing page for an example using the PRINTV instruction.

DL205 User Manual, 4th Edition, Rev. A

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

5–227

Page 450

Chapter 5: Standard RLL Instructions - ASCII

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

ASCII Swap Bytes (SWAPB) ASCII Swap Bytes instruction swaps byte positions (high–byte to low–byte and low–byte 230 The to high–byte) within each V-memory register of a series of V-memory registers for a specified 240 number of bytes. 250-1 • Starting Address: specifies the begining 260 of a series of V–memory registers the DS Used HPP N/A instruction will use to begin byte swapping • Number of Bytes: specifies the number of bytes, begining with the Starting Address, to byte swap

Parameter Starting Address Number of Bytes

DL260 Range All V-memory (See page 3-56) All V-memory (See page 3-56) or K1 to 128

Discrete Bit Flags SP53 SP71

5–228

Description On if the CPU cannot execute the instruction. On when a value used by the instruction is invalid.

Byte Swap Preferences

Byte High Low

No Byte Swapping (AIN, AEX, PRINTV, VPRINT)

A B C D E

V2000 V2001 V2002 V2003

0005h A B C D xx E

Byte Swap All Byte High Low

A B C D E

B A D C E

V2000 V2001 V2002 V2003

0005h B A C D xx E

Byte Swap All but Null Byte High Low

A B C D E

B A D C E

DL205 User Manual, 4th Edition, Rev. A

V2000 V2001 V2002 V2003

0005h B A C D xx E

Page 451

Chapter 5: Standard RLL Instructions - ASCII

SWAPB Example The AIN Complete bit is used to trigger the SWAPB instruction. Use a one–shot so the SWAPB only executes once.

ASCII Clear Buffer (ACRB)

230 240 250-1 260

The ASCII Clear Buffer instruction will clear the ASCII receive buffer of the specified communications port number. Port Number: must be DL260 port 2 (K2)

DS Used HPP N/A

ACRB Example The AIN Complete bit or the AIN diagnostic bits are used to clear the ASCII buffer.

DL205 User Manual, 4th Edition, Rev. A

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

Page 452

Chapter 5: Intelligent Box (IBox) Instructions

Intelligent Box (IBox) Instructions (DL250-1/DL260 Only)

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

A new class of instructions, called Ibox Instructions, became available with the introduction of DirectSOFT. These powerful yet easy-to-use instructions simplify many of the more complicated tasks that could previously be accomplished only through the use of multiple RLL Instructions. The IBox Instructions are supported by DL250-1 and DL260 PLCs. The D2-250-1 CPU requires firmware version v4.60 or later, and the D2-260 CPU requires firmware version v2.40 or later. For more information on DirectSOFT or to download our free version, please visit our Web site at: www.automationdirect.com.

5–230

DL205 User Manual, 4th Edition, Rev. A

Analog Helper IBoxes Instruction Analog Input / Output Combo Module Pointer Setup (ANLGCMB) Analog Input Module Pointer Setup (ANLGIN) Analog Output Module Pointer Setup (ANLGOUT) Analog Scale 12-Bit BCD to BCD (ANSCL) Analog Scale 12-Bit Binary to Binary (ANSCLB) Filter Over Time - BCD (FILTER) Filter Over Time - Binary (FILTERB) Hi/Low Alarm - BCD (HILOAL) Hi/Low Alarm - Binary (HILOALB)

IBox #

Page

IB-462 IB-460 IB-461 IB-423 IB-403 IB-422 IB-402 IB-421 IB-401

5-232 5-234 5-236 5-238 5-239 5-240 5-242 5-244 5-246

Discrete Helper IBoxes Instruction Off Delay Timer (OFFDTMR) On Delay Timer (ONDTMR) One Shot (ONESHOT) Push On / Push Off Circuit (PONOFF)

Ibox #

Page

IB-302 IB-301 IB-303 IB-300

5-248 5-250 5-252 5-253

Memory IBoxes Instruction Move Single Word (MOVEW) Move Double Word (MOVED)

Ibox #

Page

IB-200 IB-201

5-254 5-255

Math IBoxes Instruction

Ibox #

Page

BCD to Real with Implied Decimal Point (BCDTOR) Double BCD to Real with Implied Decimal Point (BCDTORD) Math - BCD (MATHBCD) Math - Binary (MATHBIN) Math - Real (MATHR) Real to BCD with Implied Decimal Point and Rounding (RTOBCD) Real to Double BCD with Implied Decimal Point and Rounding (RTOBCDD) Square BCD (SQUARE) Square Binary (SQUAREB) Square Real(SQUARER) Sum BCD Numbers (SUMBCD) Sum Binary Numbers (SUMBIN) Sum Real Numbers (SUMR)

IB-560 IB-562 IB-521 IB-501 IB-541 IB-561 IB-563 IB-523 IB-503 IB-543 IB-522 IB-502 IB-542

5-256 5-257 5-258 5-260 5-262 5-263 5-264 5-265 5-266 5-267 5-268 5-269 5-270