The text of a manual · part 30 of 40
DL05 Micro PLC User Manual, Volume 1 of 2: Chapter 5: Standard RLL and Intelligent Box Instructions, pages 274 to 283
Pages 274 to 283 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 274
Chapter 5: Intelligent Box (IBox) - Memory
Move Double Word (MOVED) (IB-201) 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 move to
Parameter
DL05 Range
From DWORD . . . . . . . . . . . . . . . . . . . . . . V,P,K To DWORD . . . . . . . . . . . . . . . . . . . . . . . . . . . V,P
K0-FFFFFFFF; See DL05 V-memory map - Data Words See DL05 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.
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–151
Page 275
Chapter 5: Intelligent Box (IBox) Math
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Math - BCD (MATHBCD) (IB-521) DS5
Used
HPP
N/A
5–152
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 V-memory 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 • WORD Result: 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 WORD Result. Each V-memory location used in the expression must be in BCD format.
Parameter WORD Result . . . . . . . . . . . . . . . . . . . . . . . . . . V Expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
DL05 Micro PLC User Manual, 6th Edition, Rev. A
DL05 Range See DL05 V-memory map - Data Words Text
Page 276
Chapter 5: Intelligent Box (IBox) - Math
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.
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–153
Page 277
Chapter 5: Intelligent Box (IBox) - Math
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Math - Binary (MATHBIN) (IB-501) DS5
Used
HPP
N/A
5–154
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 V-memory 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 • WORD Result: 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 WORD Result. Each V-memory location used in the expression must be in binary format.
Parameter WORD Result . . . . . . . . . . . . . . . . . . . . . . . . . . V Expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
DL05 Range See DL05 V-memory map - Data Words Text
DL05 Micro PLC User Manual, 6th Edition, Rev. A
Page 278
Chapter 5: Intelligent Box (IBox) - Math
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.
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–155
Page 279
Chapter 5: Intelligent Box (IBox) - Math
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Square BCD (SQUARE) (IB-523) DS5
Used
HPP
N/A
Square BCD squares the given 4-digit WORD BCD number and writes it in as an 8-digit DWORD BCD result. SQUARE Parameters • Value (WORD BCD): specifies the BCD Word or constant that will be squared • Result (DWORD BCD): specifies the location where the squared DWORD BCD value will be placed
Parameter Value (WORD BCD) . . . . . . . . . . . . . . . . . . V,P,K Result (DWORD BCD) . . . . . . . . . . . . . . . . . . . . V
DL05 Range K0-9999 ; See DL05 V-memory map - Data Words See DL05 V-memory map - Data Words
SQUARE Example
5–156
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
DL05 Micro PLC User Manual, 6th Edition, Rev. A
Page 280
Chapter 5: Intelligent Box (IBox) - Math
Square Binary (SQUAREB) (IB-503) DS5 HPP
1 2 SQUAREB Parameters 3 • Value (WORD Binary): specifies the binary Word or constant that will be squared • Result (DWORD Binary): specifies the 4 location where the squared DWORD binary value will be placed 5 Parameter DL05 Range 6 7 8 SQUAREB Example In the following example, the SQUAREB instruction is used to square the single word Binary 9 value in V2000 and store the 8-digit double word Binary result in V3000 and V3001. 10 11 12 13 14 A B C D Used
Square Binary squares the given 16-bit WORD Binary number and writes it as a 32-bit DWORD Binary result.
N/A
Value (WORD Binary) . . . . . . . . . . . . . . . . V,P,K Result (DWORD Binary) . . . . . . . . . . . . . . . . . . V
K0-65535; See DL05 V-memory map - Data Words See DL05 V-memory map - Data Words
DL05 Micro PLC User Manual, 6th Edition, Rev. A
5–157
Page 281
Chapter 5: Intelligent Box (IBox) - Math
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Sum BCD Numbers (SUMBCD) (IB-522) DS5
Used
HPP
N/A
Sum BCD Numbers sums up a list of consecutive 4-digit WORD BCD numbers into an 8-digit 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
DL05 Range See DL05 V-memory map - Data Words See DL05 V-memory map - Data Words See DL05 V-memory map - Data Words
SUMBCD Example
5–158
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.
DL05 Micro PLC User Manual, 6th Edition, Rev. A
Page 282
Chapter 5: Intelligent Box (IBox) - Math
Sum Binary Numbers (SUMBIN) (IB-502) DS5
Used
HPP
N/A
Sum Binary Numbers sums up a list of consecutive 16-bit WORD Binary numbers into a 32-bit 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 Start Address . . . . . . . . . . . . . . . . . . . . . . . . . . V End Address (inclusive) . . . . . . . . . . . . . . . . . . V Result (DWORD Binary) . . . . . . . . . . . . . . . . . . V
DL05 Range See DL05 V-memory map - Data Words See DL05 V-memory map - Data Words See DL05 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.
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–159
Page 283
Chapter 5: Intelligent Box (IBox) - Communication
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
ECOM100 Configuration (ECOM100) (IB-710) DS5
Used
HPP
N/A
5–160
ECOM100 Configuration defines all the common information for one specific ECOM100 module which is used by the other ECOM100 IBoxes; for example, ECRX - ECOM100 Network Read , ECEMAIL - ECOM100 Send EMail, ECIPSUP - ECOM100 IP Setup, etc. You MUST have the ECOM100 Configuration IBox at the top of your ladder/stage program with any other configuration IBoxes. The Message Buffer parameter specifies the starting address of a 65 WORD buffer. This is 101 Octal addresses (e.g. V1400 thru V1500). If you have more than one ECOM100 in your PLC, you must have a different ECOM100 Configuration IBox for EACH ECOM100 module in your system that utilizes any ECOM IBox instructions. The Workspace and Status parameters and the entire Message Buffer are internal, private registers used by the ECOM100 Configuration IBox and MUST BE UNIQUE in this one instruction and MUST NOT be used anywhere else in your program. In order for MOST ECOM100 IBoxes to function, you must turn ON dip switch 7 on the ECOM100 circuit board. You can keep dip switch 7 off if you are ONLY using ECOM100 Network Read and Write IBoxes (ECRX, ECWX). ECOM100 Parameters • ECOM100#: this is a logical number associated with this specific ECOM100 module in the specified slot. All other ECxxxx IBoxes that need to reference this ECOM100 module must reference this logical number • Slot: specifies the option slot the module occupies • Status: specifies a V-memory location that will be used by the instruction • Workspace: specifies a V-memory location that will be used by the instruction • Msg Buffer: specifies the starting address of a 65 word buffer that will be used by the module for configuration
Parameter ECOM100# . . . . . . . . . . . . . . . . . . . . . . . . . . . . K Slot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . K Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . V Workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . V Msg Buffer (65 words used) . . . . . . . . . . . . . . . V
DL05 Range K0-255 K1-4 See DL05 V-memory map - Data Words See DL05 V-memory map - Data Words See DL05 V-memory map - Data Words
DL05 Micro PLC User Manual, 6th Edition, Rev. A