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

The text of a manual · part 50 of 61

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

Pages 473 to 482 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 473

Chapter 5: Intelligent Box (IBox) Instructions

ONDTMR Example In the following example, the ONDTMR instruction is used to delay the “turning on” of output C21. Timer 1 (T1) is set to 2 seconds, the “on-delay” period. When C101 turns on, C21 is delayed turning on by 2 seconds. When C101 turns off, C21 turns off imediately.

Example timing diagram

C101 2 sec

2 sec

C21

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

Page 474

Chapter 5: Intelligent Box (IBox) Instructions

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

One Shot (ONESHOT) (IB-303)

230 240 250-1 260 DS5 Used HPP

One Shot will turn on the given bit output parameter for one scan on an OFF to ON transition of the power flow into the IBox. This IBox is simply a different name for the PD Coil (Positive Differential). ONESHOT Parameters • Discrete Output: specifies the output that will be on for one scan

N/A

Parameter

DL205 Range

Discrete Output . . . . . . . . . . . . . . . . . . . . . X, Y, C

See DL205 V-memory map

ONESHOT Example

5–252

In the following example, the ONESHOT instruction is used to turn C100 on for one PLC scan after C0 goes from an off to on transition. The input logic must produce an off to on transition to execute the One Shot instruction.

Example timing diagram

C0 Scan time

C100

DL205 User Manual, 4th Edition, Rev. A

Page 475

Chapter 5: Intelligent Box (IBox) Instructions

Push On/Push Off Circuit (PONOFF) (IB-300)

1

2

3

PONOFF Parameters • Discrete Input: specifies the input that will 4 toggle the specified output • Discrete Output: specifies the output that will be “turned on/off ” or toggled 5 • Internal State: specifies a work bit that is used by the instruction 6 Parameter DL205 Range 7 8 9 PONOFF Example In the following example, the PONOFF instruction is used to control the on and off states of the output C20 with a single input C10. When C10 is pressed once, C20 turns on. When 10 C10 is pressed again, C20 turns off. C100 is an internal bit used by the instruction. 11 12 13 14 NOTE: Neither a permissive nor input logic is used with this instruction. A B C D 230 240

Push On/Push Off Circuit toggles an output state whenever its input power flow transitions from off to on. Requires an extra bit parameter for scan-to-scan state information. This extra bit must NOT be used anywhere else in the program. This is also known as a “flip-flop circuit”.

250-1 260

DS5 Used

HPP

N/A

Discrete Input . . . . X,Y,C,S,T,CT,GX,GY,SP,B,PB Discrete Output . . . . . . . . . . . . . . X,Y,C,GX,GY,B Internal State . . . . . . . . . . . . . . . . . . . . . . . X, Y, C

See DL205 V-memory map See DL205 V-memory map See DL205 V-memory map

No permissive contact or input logic is used with this instruction

DL205 User Manual, 4th Edition, Rev. A

5–253

Page 476

Chapter 5: Intelligent Box (IBox) Instructions

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

Move Single Word (MOVEW) (IB-200)

230 240 250-1 260 DS5 Used HPP

Move Single Word moves (copies) a word to a memory location directly or indirectly via a pointer, either as a HEX constant, from a memory location, or indirectly through a pointer. MOVEW Parameters • From WORD: specifies the word that will be moved to another location • To WORD: specifies the location where the “From WORD” will be moved to

N/A

Parameter From WORD . . . . . . . . . . . . . . . . . . . . . . . . V,P,K To WORD. . . . . . . . . . . . . . . . . . . . . . . . . . . . . V,P

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

MOVEW Example

5–254

In the following example, the MOVEW instruction is used to move 16 bits of data from V2000 to V3000 when C100 turns on.

DL205 User Manual, 4th Edition, Rev. A

Page 477

Chapter 5: Intelligent Box (IBox) Instructions

Move Double Word (MOVED) (IB-201)

230 240 250-1 260 DS5 Used HPP

N/A

Move Double Word moves (copies) a double word to two consecutive memory locations directly or indirectly via a pointer, either as a double HEX constant, from a double memory location, or indirectly through a pointer to a double memory location. MOVED Parameters • From DWORD: specifies the double word that will be moved to another location • To DWORD: specifies the location where the “From DWORD” will be moved to

Parameter

DL205 Range

From DWORD . . . . . . . . . . . . . . . . . . . . . . V,P,K To DWORD . . . . . . . . . . . . . . . . . . . . . . . . . . . V,P

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

MOVED Example In the following example, the MOVED instruction is used to move 32 bits of data from V2000 and V2001 to 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–255

Page 478

Chapter 5: Intelligent Box (IBox) Instructions

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

BCD to Real with Implied Decimal Point (BCDTOR) (IB-560)

230 240 250-1 260

BCD to Real with Implied Decimal Point converts the given 4-digit WORD BCD value to a Real number, with the implied number of decimal points (K0-K4). For example, BCDTOR K1234 with an implied number of decimal points equal to K1, would yield R123.4 BCDTOR Parameters

DS5 Used HPP

N/A

• Value (WORD BCD): specifies the word or constant that will be converted to a Real number • Number of Decimal Points: specifies the number of implied decimal points in the Result DWORD • Result (DWORD REAL): specifies the location where the Real number will be placed

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

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

BCDTOR Example

5–256

In the following example, the BCDTOR instruction is used to convert the 16-bit data in V2000 from a 4-digit BCD data format to a 32-bit REAL (floating point) data format and store into V3000 and V3001 when C100 turns on. K2 in the Number of Decimal Points implies the data will have two digits to the right of the decimal point.

DL205 User Manual, 4th Edition, Rev. A

Page 479

Chapter 5: Intelligent Box (IBox) Instructions

Double BCD to Real with Implied Decimal Point (BCDTORD) (IB-562)

1

2

3

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

250-1 260

Double BCD to Real with Implied Decimal Point converts the given 8-digit DWORD BCD value to a Real number, given an implied number of decimal points (K0-K8). For example, BCDTORD K12345678 with an implied number of decimal points equal to K5, would yield R123.45678

DS5 Used HPP

N/A

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

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

DL205 User Manual, 4th Edition, Rev. A

5–257

Page 480

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 - BCD (MATHBCD) (IB-521)

230 240 250-1 260 DS5 Used HPP

N/A

5–258

Math - BCD 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 Modulo (% aka Remainder), Bit-wise And (&) Or (|) Xor (^), and some BCD functions - Convert to BCD (BCD), Convert to Binary (BIN), BCD Complement (BCDCPL), Convert from Gray Code (GRAY), Invert Bits (INV), and BCD/HEX to Seven Segment Display (SEG). Example: ((V2000 + V2001) / (V2003 - K100)) * GRAY(V3000 & K001F) Every V-memory reference MUST be to a single-word BCD formatted value. Intermediate results can go up to 32-bit values, but as long as the final result fits in a 16-bit BCD word, the calculation is valid. Typical example of this is scaling using multiply then divide, (V2000 * K1000) / K4095. The multiply term most likely will exceed 9999 but fits within 32 bits. The divide operation will divide 4095 into the 32-bit accumulator, yielding a result that will always fit in 16 bits. You can reference binary V-memory values by using the BCD conversion function on a Vmemory location but NOT an expression. That is BCD(V2000) is okay and will convert V2000 from Binary to BCD, but BCD(V2000 + V3000) will add V2000 as BCD, to V3000 as BCD, then interpret the result as Binary and convert it to BCD - NOT GOOD. Also, the final result is a 16-bit BCD number and so you could do BIN around the entire operation to store the result as Binary. MATHBCD Parameters • Result (WORD): specifies the location where the BCD result of the mathematical expression will be placed (result must fit into 16-bit single V-memory location) • Expression: specifies the mathematical expression to be executed and the result is stored in specified Result (WORD). Each V-memory location used in the expression must be in BCD format.

Parameter WORD Result . . . . . . . . . . . . . . . . . . . . . . . . . . V Expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

DL205 User Manual, 4th Edition, Rev. A

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

Page 481

Chapter 5: Intelligent Box (IBox) Instructions

MATHBCD Example In the following example, the MATHBCD instruction is used to calculate the math expression which multiplies the BCD 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–259

Page 482

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 - Binary (MATHBIN) (IB-501) 230 240 250-1 260

DS5 Used

HPP

N/A

5–260

Math - Binary 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 Modulo (% aka Remainder), Shift Right (>>) and Shift Left (<<), Bit-wise And (&) Or (|) Xor (^), and some binary functions - Convert to BCD (BCD), Convert to Binary (BIN), Decode Bits (DECO), Encode Bits (ENCO), Invert Bits (INV), HEX to Seven Segment Display (SEG), and Sum Bits (SUM). Example: ((V2000 + V2001) / (V2003 - K10)) * SUM(V3000 & K001F) Every V-memory reference MUST be to a single-word binary formatted value. Intermediate results can go up to 32-bit values, but as long as the final result fits in a 16-bit binary word, the calculation is valid. Typical example of this is scaling using multiply then divide, (V2000 * K1000) / K4095. The multiply term most likely will exceed 65535 but fits within 32 bits. The divide operation will divide 4095 into the 32-bit accumulator, yielding a result that will always fit in 16 bits. You can reference BCD V-memory values by using the BIN conversion function on a Vmemory location but NOT an expression. That is, BIN(V2000) is okay and will convert V2000 from BCD to Binary, but BIN(V2000 + V3000) will add V2000 as Binary, to V3000 as Binary, then interpret the result as BCD and convert it to Binary - NOT GOOD. Also, the final result is a 16-bit binary number and so you could do BCD around the entire operation to store the result as BCD. MATHBIN Parameters • Result (WORD): specifies the location where the binary result of the mathematical expression will be placed (result must fit into 16-bit single V-memory location) • Expression: specifies the mathematical expression to be executed and the result is stored in specified Result (WORD). Each V-memory location used in the expression must be in binary format.

Parameter WORD Result . . . . . . . . . . . . . . . . . . . . . . . . . . V Expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

DL205 User Manual, 4th Edition, Rev. A

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