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

The text of a manual · part 51 of 61

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

Pages 483 to 492 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 483

Chapter 5: Intelligent Box (IBox) Instructions

MATHBIN Example In the following example, the MATHBIN instruction is used to calculate the math expression which multiplies the Binary value in V1200 by 1000 then divides by 4095 and loads the resulting value in V2000 when C100 turns on.

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–261

Page 484

Chapter 5: Intelligent Box (IBox) Instructions

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

Math - Real (MATHR) (IB-541)

230 240 250-1 260 DS5 Used HPP

N/A

Math - Real Format lets you enter complex mathematical expressions like you would in Visual Basic, Excel, or C++ to do complex calculations, nesting parentheses up to 4 levels deep. In addition to + - * /, you can do Bit-wise And (&) Or (|) and Xor (^). The DL260 also supports several Real functions Arc Cosine (ACOSR), Arc Sine (ASINR), Arc Tangent (ATANR), Cosine (COSR), Convert Radians to Degrees (DEGR), Invert Bits (INV), Convert Degrees to Radians (RADR), HEX to Seven Segment Display (SEG), Sine (SINR), Square Root (SQRTR), and Tangent (TANR). Example: ((V2000 + V2002) / (V2004 - R2.5)) * SINR(RADR(V3000 / R10.0)) Every V-memory reference MUST be able to fit into a double-word Real formatted value. MATHR Parameters • Result (DWORD): specifies the location where the Real result of the mathematical expression will be placed (result must fit into a double-word Real formatted location) • Expression: specifies the mathematical expression to be executed and the result is stored in specified Result (DWORD) location. Each V-memory location used in the expression must be in Real format.

Parameter DWORD Result . . . . . . . . . . . . . . . . . . . . . . . . V Expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

DL205 Range See DL205 V-memory map - Data Words Text

MATHR Example

5–262

In the following example, the MATHR instruction is used to calculate the math expression which multiplies the REAL (floating point) value in V1200 by 10.5 then divides by 2.7 and loads the resulting 32-bit value in V2000 and V2001 when C100 turns on.

DL205 User Manual, 4th Edition, Rev. A

Page 485

Chapter 5: Intelligent Box (IBox) Instructions

Real to BCD with Implied Decimal Point and Rounding (RTOBCD) (IB-561)

1

2

3

4 5 6 RTOBCD Parameters 7 • Value (DWORD Real): specifies the Real Dword location or number that will be converted and rounded to a BCD number with decimal points 8 • Number of Decimal Points: specifies the number of implied decimal points in the Result WORD • Result (WORD BCD): specifies the location where the rounded/implied decimal points BCD value will be placed 9 10 Parameter DL205 Range 11 12 RTOBCD Example In the following example, the RTOBCD instruction is used to convert the 32-bit REAL 13 (floating point) data format in V3000 and V3001 to the 4-digit BCD data format and store in V2000 when C100 turns on. 14 K2 in the Number of Decimal Points implies the data will have two implied decimal points. A B C D 230 240

250-1 260

DS5 Used HPP

N/A

Real to BCD with Implied Decimal Point and Rounding converts the absolute value of the given Real number to a 4-digit BCD number, compensating for an implied number of decimal points (K0-K4) and performs rounding. For example, RTOBCD R56.74 with an implied number of decimal points equal to K1, would yield 567 BCD. If the implied number of decimal points was 0, then the function would yield 57 BCD (note that it rounded up). If the Real number is negative, the Result will equal its positive, absolute value.

Value (DWORD Real) . . . . . . . . . . . . . . . . . V,P,R Number of Decimal Points . . . . . . . . . . . . . . . K Result (WORD BCD) . . . . . . . . . . . . . . . . . . . . . V

R ; See DL205 V-memory map - Data Words K0-4 See DL205 V-memory map - Data Words

DL205 User Manual, 4th Edition, Rev. A

5–263

Page 486

Chapter 5: Intelligent Box (IBox) Instructions

Real to Double BCD with Implied Decimal Point and Rounding (RTOBCDD) (IB-563)

1 Real to Double BCD with Implied Decimal Point and Rounding converts the absolute 2 value of the given Real number to an 8-digit DWORD BCD number, compensating for

3 an implied number of decimal points (K0K8) and performs rounding.

For example, RTOBCDD R38156.74 with 4 an implied number of decimal points equal to K1, would yield 381567 BCD. If the 5 implied number of decimal points was 0, then the function would yield 38157 BCD 6 (note that it rounded up). If the Real number is negative, the Result will equal its positive, absolute value. 7 RTOBCDD Parameters 8 • Value (DWORD Real): specifies the Dword Real number that will be converted and rounded to a BCD number with decimal points • Number of Decimal Points: specifies the number of implied decimal points in the Result DWORD 9 • Result (DWORD BCD): specifies the location where the rounded/implied decimal points DWORD BCD value will be placed 10 Parameter DL205 Range 11 12 RTOBCDD Example 13 In the following example, the RTOBCDD instruction is used to convert the 32-bit REAL (floating point) data format in V3000 and V3001 to the 8-digit BCD data format and store in V2000 and V2001 when C100 turns on. 14 K2 in the Number of Decimal Points implies the data will have two implied decimal points. A B C D 230 240

250-1 260

DS5

Used

HPP

N/A

Value (DWORD Real) . . . . . . . . . . . . . . . . . V,P,R Number of Decimal Points . . . . . . . . . . . . . . . K Result (DWORD BCD) . . . . . . . . . . . . . . . . . . . . V

5–264

DL205 User Manual, 4th Edition, Rev. A

R ; See DL205 V-memory map - Data Words K0-8 See DL205 V-memory map - Data Words

Page 487

Chapter 5: Intelligent Box (IBox) Instructions

Square BCD (SQUARE) (IB-523) Square BCD squares the given 4-digit WORD BCD number and writes it as an 8-digit DWORD BCD result.

230 240 SQUARE Parameters 250-1 • Value (WORD BCD): specifies the BCD 260 Word or constant that will be squared DS5

Used

HPP

N/A

• Result (DWORD BCD): specifies the location where the squared DWORD BCD value will be placed

Parameter

DL205 Range

Value (WORD BCD) . . . . . . . . . . . . . . . . . . V,P,K Result (DWORD BCD) . . . . . . . . . . . . . . . . . . . . V

K0-9999 ; See DL205 V-memory map - Data Words See DL205 V-memory map - Data Words

SQUARE Example In the following example, the SQUARE instruction is used to square the 4-digit BCD value in V2000 and store the 8-digit double word BCD result in V3000 and V3001 when C100 turns on.

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–265

Page 488

Chapter 5: Intelligent Box (IBox) Instructions

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

Square Binary (SQUAREB) (IB-503) Square Binary squares the given 16-bit WORD Binary number and writes it as a 32-bit DWORD Binary result.

230 240 SQUAREB Parameters 250-1 • Value (WORD Binary): specifies the binary 260 Word or constant that will be squared DS5

Used

HPP

N/A

• Result (DWORD Binary): specifies the location where the squared DWORD binary value will be placed

Parameter Value (WORD Binary) . . . . . . . . . . . . . . . . V,P,K Result (DWORD Binary) . . . . . . . . . . . . . . . . . . V

DL205 Range K0-65535; See DL205 V-memory map - Data Words See DL205 V-memory map - Data Words

SQUAREB Example

5–266

In the following example, the SQUAREB instruction is used to square the single-word Binary value in V2000 and store the 8-digit double-word Binary result in V3000 and V3001 when C100 turns on.

DL205 User Manual, 4th Edition, Rev. A

Page 489

Chapter 5: Intelligent Box (IBox) Instructions

Square Real (SQUARER) (IB-543)

230 240 250-1 260 DS5

Used

HPP

N/A

Square Real squares the given REAL DWORD number and writes it to a REAL DWORD result. SQUARER Parameters • Value (REAL DWORD): specifies the Real DWORD location or number that will be squared • Result (REAL DWORD): specifies the location where the squared Real DWORD value will be placed

Parameter

DL205 Range

Value (REAL DWORD) . . . . . . . . . . . . . . . . V,P,R Result (REAL DWORD) . . . . . . . . . . . . . . . . . . . V

R ; See DL205 V-memory map - Data Words See DL205 V-memory map - Data Words

SQUARER Example In the following example, the SQUARER instruction is used to square the 32-bit floating point REAL value in V2000 and V2001 and store the REAL value result in V3000 and V3001 when C100 turns on.

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–267

Page 490

Chapter 5: Intelligent Box (IBox) Instructions

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

Sum BCD Numbers (SUMBCD) (IB-522)

230 240 250-1 260 DS5

Used

HPP

N/A

Sum BCD Numbers sums up a list of consecutive 4-digit WORD BCD numbers into an 8digit DWORD BCD result. You specify the group's starting and ending V-memory addresses (inclusive). When enabled, this instruction will add up all the numbers in the group (so you may want to place a differential contact driving the enable). SUMBCD could be used as the first part of calculating an average. SUMBCD Parameters • Start Address: specifies the starting address of a block of V-memory location values to be added together (BCD) • End Addr (inclusive): specifies the ending address of a block of V-memory location values to be added together (BCD) • Result (DWORD BCD): specifies the location where the sum of the block of V-memory BCD values will be placed

Parameter Start Address . . . . . . . . . . . . . . . . . . . . . . . . . . V End Address (inclusive) . . . . . . . . . . . . . . . . . . V Result (DWORD BCD) . . . . . . . . . . . . . . . . . . . . V

DL205 Range See DL205 V-memory map - Data Words See DL205 V-memory map - Data Words See DL205 V-memory map - Data Words

SUMBCD Example

5–268

In the following example, the SUMBCD instruction is used to total the sum of all BCD values in words V2000 thru V2007 and store the resulting 8-digit double word BCD value in V3000 and V3001 when C100 turns on.

DL205 User Manual, 4th Edition, Rev. A

Page 491

Chapter 5: Intelligent Box (IBox) Instructions

Sum Binary Numbers (SUMBIN) (IB-502)

230 240 250-1 260 DS5

Used

HPP

N/A

Sum Binary Numbers sums up a list of consecutive 16-bit WORD Binary numbers into a 32bit DWORD binary result. You specify the group's starting and ending V-memory addresses (inclusive). When enabled, this instruction will add up all the numbers in the group (so you may want to place a differential contact driving the enable). SUMBIN could be used as the first part of calculating an average. SUMBIN Parameters • Start Address: specifies the starting address of a block of V-memory location values to be added together (Binary) • End Addr (inclusive): specifies the ending address of a block of V-memory location values to be added together (Binary) • Result (DWORD Binary): specifies the location where the sum of the block of V-memory binary values will be placed

Parameter

DL205 Range

Start Address . . . . . . . . . . . . . . . . . . . . . . . . . . V End Address (inclusive) . . . . . . . . . . . . . . . . . . V Result (DWORD Binary) . . . . . . . . . . . . . . . . . . V

See DL205 V-memory map - Data Words See DL205 V-memory map - Data Words See DL205 V-memory map - Data Words

SUMBIN Example In the following example, the SUMBIN instruction is used to total the sum of all Binary values in words V2000 thru V2007 and store the resulting 8-digit double word Binary value in V3000 and V3001 when C100 turns on.

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–269

Page 492

Chapter 5: Intelligent Box (IBox) Instructions

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

Sum Real Numbers (SUMR) (IB-542)

230 240 250-1 260 DS5

Used

HPP

N/A

5–270

Sum Real Numbers sums up a list of consecutive REAL DWORD numbers into a REAL DWORD result. You specify the group's starting and ending V-memory addresses (inclusive). Remember that Real numbers are DWORDs and occupy 2 words of V-memory each, so the number of Real values summed up is equal to half the number of memory locations. Note that the End Address can be EITHER word of the 2 word ending address, for example, if you wanted to add the 4 Real numbers stored in V2000 thru V2007 (V2000, V2002, V2004, and V2006), you can specify V2006 OR V2007 for the ending address and you will get the same result. When enabled, this instruction will add up all the numbers in the group (so you may want to place a differential contact driving the enable). SUMR could be used as the first part of calculating an average. SUMR Parameters • Start Address (DWORD): specifies the starting address of a block of V-memory location values to be added together (Real) • End Addr (inclusive) (DWORD): specifies the ending address of a block of V-memory location values to be added together (Real) • Result (DWORD): specifies the location where the sum of the block of V-memory Real values will be placed

Parameter Start Address (DWORD) . . . . . . . . . . . . . . . . . V End Address (inclusive DWORD) . . . . . . . . . . V Result (DWORD) . . . . . . . . . . . . . . . . . . . . . . . . V

DL205 User Manual, 4th Edition, Rev. A

DL205 Range See DL205 V-memory map - Data Words See DL205 V-memory map - Data Words See DL205 V-memory map - Data Words