RLL and InteLLIgent Box InstRuctIons
ChapterChapterChapter
5In This Chapter...
Introduction ............................................................................................................... 5-2
Using Boolean Instructions ....................................................................................... 5-5
Boolean Instructions ............................................................................................... 5-10
Comparative Boolean .............................................................................................. 5-27
Immediate Instructions ........................................................................................... 5-33
Timer, Counter and Shift Register Instructions ...................................................... 5-41
Accumulator/Stack Load and Output Data Instructions ........................................ 5-53
Logical Instructions (Accumulator) ......................................................................... 5-71
Math Instructions .................................................................................................... 5-88
Transcendental Functions (D2-260/D2-262 only)................................................. 5-121
Bit Operation Instructions ..................................................................................... 5-123
Number Conversion Instructions (Accumulator) .................................................. 5-130
Table Instructions .................................................................................................. 5-144
Clock/Calendar Instructions .................................................................................. 5-175
CPU Control Instructions ....................................................................................... 5-177
Program Control Instructions ............................................................................... 5-179
Interrupt Instructions ............................................................................................ 5-187
Intelligent I/O Instructions .................................................................................... 5-191
Network Instructions ............................................................................................. 5-193
Message Instructions ............................................................................................. 5-197
Modbus RTU Instructions (D2-260/D2-262) ......................................................... 5-205
ASCII Instructions (D2-260/D2-262) ..................................................................... 5-211
Intelligent Box (IBox) Instructions (D2-250-1/D2-260/D2-262 Only) ................. 5-230
NOTE: As of 07/2021 CPU D2-260 has been retired. Please consider CPU D2-262 as a replacement.
DL205 User Manual, 5th Edition, Rev. B5-2
Chapter 5: Standard RLL Instructions
IntroductionThe DL205 CPUs offer a wide variety of instructions to perform many different types of operations. Several instructions are not available in all of the CPUs. This chapter shows you how to use these individual instructions. There are two ways to quickly find the instruction you need:
• If you know the instruction category (Boolean, Comparative Boolean, etc), use the header at the top of the page to find the pages that discuss the instructions in that category.
• If you know the individual instruction name, use the following table to find the page that discusses the instruction.
Instruction PageBIN Binary 5–130BCALL Block Call (Stage) 7–27BEND Block End (Stage) 7–27BLK Block (Stage) 7–27BTOR Binary to Real 5–134CMP Compare 5–83CMPD Compare Double 5–84CMPF Compare Formatted 5–85CMPR Compare Real Number 5–87CMPS Compare Stack 5–86CMPV ASCII Compare 5–221CNT Counter 5–46COSR Cosine Real 5–121CV Converge (Stage) 7–25CVJMP Converge Jump (Stage) 7–25DATE Date 5–175DEC Decrement 5–100DECB Decrement Binary 5–108DECO Decode 5–129DEGR Degree Real Conversion 5–136DISI Disable Interrupts 5–188DIV Divide 5–97DIVB Divide Binary 5–106DIVBS Divide Binary Top of Stack 5–120DIVD Divide Double 5–98DIVF Divide Formatted 5–112DIVR Divide Real Number 5–99DIVS Divide Top of Stack 5–116DLBL Data Label 5–199DRUM Timed Drum 6–12EDRUM Event Drum 6–14ENCO Encode 5–128END End 5–177ENI Enable Interrupts 5–188
Instruction PageACON ASCII Constant 5–199ACOSR Arc Cosine Real 5–122ACRB ASCII Clear Buffer 5–229ADD Add BCD 5–88ADDB Add Binary 5–101ADDBD Add Binary Double 5–102ADDBS Add Binary Top of Stack 5–117ADDD Add Double BCD 5–89ADDF Add Formatted 5–109ADDR Add Real 5–90ADDS Add Top of Stack 5–113AEX ASCII Extract 5–220AFIND ASCII Find 5–217AIN ASCII IN 5–212AND And for contacts or boxes 5–14, 5–32, 5–71AND STR And Store 5–16ANDB And Bit–of–Word 5–15ANDD And Double 5–72ANDE And if Equal 5–29ANDF And Formatted 5–73ANDI And Immediate 5–35ANDMOV And Move 5–171ANDN And Not 5–14, 5–32ANDNB And Not Bit–of–Word 5–15ANDND And Negative Differential 5–23ANDNE And if Not Equal 5–29ANDNI And Not Immediate 5–35ANDPD And Positive Differential 5–23ANDS And Stack 5–74ASINR Arc Sine Real 5–121ATANR Arc Tangent Real 5–122ATH ASCII to Hex 5–137ATT Add to Top of Table 5–166BCD Binary Coded Decimal 5–131BCDCPL Tens Complement 5–133
DL205 User Manual, 5th Edition, Rev. B 5-3
Chapter 5: Standard RLL Instructions
Instruction PageFAULT Fault 5-197FDGT Find Greater Than 5-152FILL Fill 5–150FIND Find 5–151FINDB Find Block 5–173FOR For/Next 5–180GOTO Goto/Label 5–179GRAY Gray Code 5–141GTS Goto Subroutine 5–182HTA Hex to ASCII 5–138INC Increment 5–100INCB Increment Binary 5–107INT Interrupt 5–187INV Invert 5–132IRT Interrupt Return 5–188IRTC Interrupt Return Conditional 5–188ISG Initial Stage 7–24JMP Jump 7–24LBL Label 5–179LD Load 5–58LDI Load Immediate 5–39LDIF Load Immediate Formatted 5–40LDA Load Address 5-61LDD Load Double 5–59LDF Load Formatted 5–60LDR Load Real Number 5–64LDX Load Indexed 5–62LDLBL Load Label 5–145LDSX Load Indexed from Constant 5–63MDRMD Masked Drum Event Discrete 6–19MDRMW Masked Drum Event Word 6–21MLR Master Line Reset 5–185MLS Master Line Set 5–185MOV Move 5–144MOVMC Move Memory Cartridge 5–145MRX Read from MODBUS Network 5–205MWX Write to MODBUS 5–208MUL Multiply 5–94MULB Multiply Binary 5–105MULBS Multiply Binary top of stack 5–119MULD Multiply Double 5–95MULF Multiply Formatted 5–111MULR Multiply Real 5–96MULS Multiply Top of Stack 5–115NCON Numeric Constand 5–199NEXT Next (For/Next) 5–180
Instruction PageNJMP Not Jump (Stage) 7–24NOP No Operation 5-177NOT Not 5–19OR Or 5–12, 5–31, 5–75OR OUT Or Out 5–19OR OUTI Or Out Immediate 5–36OR STR Or Store 5–16ORB Or Bit–of–Word 5–13ORD Or Double 5–76ORE Or if Equal 5–28ORF Or Formatted 5–77ORI Or Immediate 5–34ORMOV Or Move 5–171ORN Or Not 5–12, 5–31ORNB Or Not Bit–of–Word 5–13ORND Or Negative Differential 5–22ORNE Or if Not Equal 5–28ORNI Or Not Immediate 5–34ORPD Or Positive Differential 5–22ORS Or Stack 5–78OUT Out 5–17, 5–65OUTB Out Bit–of–Word 5–18OUTD Out Double 5–66OUTF Out Formatted 5–67OUTI Out Immediate 5–36OUTIF Out Immediate Formatted 5–37OUTL Out Least 5–69OUTM Out Most 5–69OUTX Out Indexed 5–68PAUSE Pause 5–26PD Positive Differential 5–20POP Pop 5–70PRINT Print 5–201PRINTV ASCII Print from V–Memory 5–227RADR Radian Real Conversion 5–136RD Read from Intelligent Module 5–191RFB Remove from Bottom of Table 5–157RFT Remove from Top of Table 5–163ROTL Rotate Left 5–126ROTR Rotate Right 5–127RST Reset 5–24RSTB Reset Bit–of–Word 5–25RSTBIT Reset Bit 5–148RSTI Reset Immediate 5–38RSTWT Reset Watch Dog Timer 5–178
DL205 User Manual, 5th Edition, Rev. B5-4
Chapter 5: Standard RLL Instructions
Instruction PageSUB Subtract 5–91SUBB Subtract Binary 5–103SUBBD Subtract Binary Double 5–104SUBBS Subtract Binary Top of Stack 5–118SUBD Subtract Double 5–92SUBF Subtract Formatted 5–110SUBS Subtract Top of Stack 5–114SUBR Subtract Real Number 5–93SUM Sum 5–123SWAP Swap Table Data 5–174SWAPB ASCII Swap Bytes 5–228TANR Tangent Real 5–121TIME Time 5–176TMR Timer 5–42TMRF Fast Timer 5–42TMRA Accumulating Timer 5–44TMRAF Fast Accumulating Timer 5–44TSHFL Table Shift Left 5–169TSHFR Table Shift Right 5–169TTD Table to Destination 5–154UDC Up Down Counter 5–50VPRINT ASCII Print to V–Memory 5–222WT Write to Intelligent Module 5–192WX Write to Network 5–195XOR Exclusive Or 5–79XORD Exclusive Or Double 5–80XORF Exclusive Or Formatted 5–81XORMOV Exclusive Or Move 5–171XORS Exclusive Or Stack 5–82
Instruction PageRT Subroutine Return 5–182RTC Subroutine Return Conditional 5–182RTOB Real to Binary 5–135RX Read from Network 5–193SBR Subroutine (Goto Subroutine) 5–182SEG Segment 5–140SET Set 5–24SETB Set Bit–of–Word 5–25SETBIT Set Bit 5–148SETI Set Immediate 5–38SFLDGT Shuffle Digits 5–142SG Stage 7–23SGCNT Stage Counter 5–48SHFL Shift Left 5–124SHFR Shift Right 5–125SINR Sine Real 5–121SQRTR Square Root Real 5–122SR Shift Register 5–52STOP Stop 5–177STR Store 5–10, 5–30STRB Store Bit–of–Word 5–11STRE Store if Equal 5–27STRI Store Immediate 5–33STRN Store Not 5–10, 5–30STRNB Store Not Bit–of–Word 5–11STRND Store Negative Differential 5–21STRNE Store if Not Equal 5–27STRNI Store Not Immediate 5–33STRPD Store Positive Differential 5–21STT Source to Table 5–160
DL205 User Manual, 5th Edition, Rev. B 5-5
Chapter 5: Standard RLL Instructions
Using Boolean InstructionsDo you ever wonder why so many PLC manufacturers always quote the scan time for a 1K boolean program? Simple, most programs utilize many boolean instructions. These are typically very simple instructions designed to join input and output contacts in various series and parallel combinations. Our DirectSOFT programming package is a similar program. It uses graphic symbols to develop a program; therefore, you don’t necessarily have to know the instruction mnemonics in order to develop your program.
Many of the instructions in this chapter are not program instructions used in DirectSOFT, but are implied. In other words, they are not actually keyboard commands but they can be seen in a Mnemonic View of the program once the DirectSOFT program has been developed and accepted (compiled). Each instruction listed in this chapter will have a small chart to indicate how the instruction is used with DirectSOFT and the HPP.
The following paragraphs describe how these instructions are used to build simple ladder programs.
END StatementAll DL205 programs require an END statement as the last instruction. This tells the CPU that this is the end of the program. Normally, any instructions placed after the END statement will not be executed. There are exceptions to this such as interrupt routines, etc. Chapter 5 discusses the instruction set in detail.
Simple RungsYou use a contact to start rungs that contain both contacts and coils. The boolean instruction that does this is called a Store or, STR instruction. The output point is represented by the Output or, OUT instruction. The following example shows how to enter a single contact and a single output coil.
OUTY0X0
END
DirectSOFT Example Handheld Mnemonics
STR X0OUT Y0END
OUTY0X0
END
All programs must have an END statement
DS ImpliedHPP Used
DirectSOFT Example
DL205 User Manual, 5th Edition, Rev. B5-6
Chapter 5: Standard RLL Instructions
Normally Closed ContactNormally closed contacts are also very common. This is accomplished with the Store Not, or STRN instruction. The following example shows a simple rung with a normally closed contact.
Contacts in SeriesUse the AND instruction to join two or more contacts in series. The following example shows two contacts in series and a single output coil. The instructions used would be STR X0, AND X1, followed by OUT Y0.
Midline OutputsSometimes it is necessary to use midline outputs to get additional outputs that are conditional on other contacts. The following example shows how you can use the AND instruction to continue a rung with more conditional outputs.
OUTY0X0
END
X1
DirectSOFT Example Handheld Mnemonics
STR X0AND X1OUT Y0END
OUTY0X0
END
X1
DirectSOFT Example Handheld Mnemonics
STR X0AND X1OUT Y0AND X2OUT Y1AND X3OUT Y2END
X2OUTY1
X3OUTY2
OUTY0X0
END
DirectSOFT Example Handheld Mnemonics
STRN X0OUT Y0END
DL205 User Manual, 5th Edition, Rev. B 5-7
Chapter 5: Standard RLL Instructions
Parallel ElementsYou may also have to join contacts in parallel. The OR instruction allows you to do this. The following example shows two contacts in parallel and a single output coil. The instructions would be STR X0, OR X1, followed by OUT Y0.
Joining Series Branches in ParallelQuite often it is necessary to join several groups of series elements in parallel. The Or Store (ORSTR) instruction allows this operation. The following example shows a simple network consisting of series elements joined in parallel.
Joining Parallel Branches in SeriesYou can also join one or more parallel branches in series. The And Store (ANDSTR) instruction allows this operation. The following example shows a simple network with contact branches in series with parallel contacts.
Combination NetworksYou can combine the various types of series and parallel branches to solve most any application problem. The following example shows a simple combination network.
OUTY0X0
END
X1
DirectSOFT Example Handheld Mnemonics
STR X0OR X1OUT Y0END
OUTY0X0
END
X2
X1
X3
DirectSOFT Example Handheld Mnemonics
STR X0AND X1STR X2AND X3ORSTROUT Y0END
OUTY0X0
END
X1
X2
DirectSOFT Example Handheld Mnemonics
STR X0STR X1OR X2ANDSTROUT Y0END
OUT
Y0X0
END
X2
X3X1 X4
X5
X6
DL205 User Manual, 5th Edition, Rev. B5-8
Chapter 5: Standard RLL Instructions
Comparative BooleanThe DL205 Micro PLCs provide Comparative Boolean instructions that allow you to quickly and easily compare two numbers. The Comparative Boolean provides evaluation of two 4-digit values using boolean contacts. The valid evaluations are: equal to, not equal to, equal to or greater than, and less than.
In the example ,when the BCD value in V-memory location V1400 is equal to the constant value 1234, Y3 will energize.
Boolean StackThere are limits to how many elements you can include in a rung. This is because the DL205 CPUs use an 8-level boolean stack to evaluate the various logic elements. The boolean stack is a temporary storage area that solves the logic for the rung. Each time you enter a STR instruction, the instruction is placed on the top of the boolean stack. Any other STR instructions on the boolean stack are pushed down a level. The ANDSTR, and ORSTR instructions combine levels of the boolean stack when they are encountered. Since the boolean stack is only eight levels, an error will occur if the CPU encounters a rung that uses more than the eight levels of the boolean stack.
The following example shows how the boolean stack is used to solve boolean logic.
X1 or (X2 AND X3)
STR X0 STR X1 STR X21 STR X0
2
3
4
1 STR X1
2 STR X0
3
4
1
2
3
4
AND X31
2
3
4
ORSTR1
2 STR X0
3
OUTY0X0 X1
X2 X3
X4
X5
STR
OR
AND
ORSTR
ANDSTR
OutputSTR
STR
AND
X4 AND {X1 or (X2 AND X3)}
AND X412 STR X03
NOT X5 OR X4 AND {X1 OR (X2 AND X3)}
ORNOT X51
2
3
ANDSTRXO AND (NOT X5 or X4) AND {X1 or (X2 AND X3)}1
2
3
STR X0
STR X2
STR X1
STR X0
STR X2
STR X1
STR X0
Y3OUT
V1400 K1234
DL205 User Manual, 5th Edition, Rev. B 5-9
Chapter 5: Standard RLL Instructions
Immediate BooleanThe DL205 Micro PLCs can usually complete an operation cycle in a matter of milliseconds. However, in some applications you may not be able to wait a few milliseconds until the next I/O update occurs. The DL205 PLCs offer immediate input and outputs which are special boolean instructions that allow reading directly from inputs and writing directly to outputs during the program execution portion of the CPU cycle. You may recall that this is normally done during the input or output update portion of the CPU cycle. The immediate instructions take longer to execute because the program execution is interrupted while the CPU reads or writes the I/O point. This function is not normally done until the read inputs or the write outputs portion of the CPU cycle.
NOTE: Even though the immediate input instruction reads the most current status from the input point, it only uses the results to solve that one instruction. It does not use the new status to update the image register. Therefore, any regular instructions that follow will still use the image register values. Any immediate instructions that follow will access the I/O again to update the status. The immediate output instruction will write the status to the I/O and update the image register.
X0OFF
X1OFF
CPU Scan
Read Inputs
Diagnostics
Input Image Register
The CPU reads the inputs fromthe local base and stores thestatus in an input imageregister .
X0 Y0
X0X1X2...X128OFFOFFON...OFF
Solve the Application Program
Read Inputs from Specialty I/O
Write Outputs
Write Outputs to Specialty I/O
X0ON
X1OFF
Immediate instruction doesnot use the input imageregister , but instead reads thestatus from the moduleimmediately. I/O Point X0 Changes
X0_X7
X10_X17
X20_X27
Y0_Y7
Y10_Y17
Y20_Y27
Y30_Y37
X30_X37
I
DL205 User Manual, 5th Edition, Rev. B5-10
Chapter 5: Standard RLL Instructions
Boolean Instructions Store (STR)
The Store instruction begins a new rung or an additional branch in a rung with a normally open contact. Status of the contact will be the same state as the associated image register point or memory location.
Store Not (STRN)The Store Not instruction begins a new rung or an additional branch in a rung with a normally closed contact. Status of the contact will be opposite the state of the associated image register point or memory location.
In the following Store example, when input X1 is on output Y2 will energize.
In the following Store Not example, when input X1 is off output Y2 will energize.
Aaaa
Aaaa
�����
230
240
250-1
260
262
DS UsedHPP Used
Operand Data Type Range D2-230 D2-240 D2-250-1 D2-260/D2-262
A aaa aaa aaa aaaInputs X 0 – 177 0 – 477 0 – 777 0 – 1777Outputs Y 0 – 177 0 – 477 0 – 777 0 – 1777Control Relays C 0 – 377 0 – 377 0 – 1777 0 – 3777Stage S 0 – 377 0 – 777 0 – 1777 0 – 1777Timer T 0 – 77 0 – 177 0 – 377 0 – 377Counter CT 0 – 77 0 – 177 0 – 177 0 – 377Special Relay SP 0 – 117, 540 – 577 0 – 137 540 – 617 0 – 777 0 – 777Global GX – – – 0 –3777Global GY – – – 0 – 3777
STRNSP
1B ENT
OUTGX
2C ENT
Y2
OUT
X1Handheld Programmer KeystrokesDirectSOFT
STR$
1B ENT
OUTGX
2C ENT
Handheld Programmer KeystrokesDirectSOFT
Y2
OUT
X1
DL205 User Manual, 5th Edition, Rev. B 5-11
Chapter 5: Standard RLL Instructions
Store Bit-of-Word (STRB)The Store Bit-of-Word instruction begins a new rung or an additional branch in a rung with a normally open contact. Status of the contact will be the same state as the bit referenced in the associated memory location.
Store Not Bit-of-Word (STRNB)The Store Not instruction begins a new rung or an additional branch in a rung with a normally closed contact. Status of the contact will be opposite the state of the bit referenced in the associated memory location.
In the following Store Bit-of-Word example, when bit 12 of V-memory location V1400 is on, output Y2 will energize.
In the following Store Not Bit-of-Word example, when bit 12 of V-memory location V1400
i s off, output Y2 will energize.
Aaaa.bb
Aaaa.bb
230
240
250-1
260
262
�����
230
240
250-1
260
262
�����
Operand Data Type D2-250-1 Range D2-260/D2-262 Range A aaa bb aaa bb
V-memory B See memory map page 3-56 BCD, 0 to 15 See memory map
page 3-57 BCD, 0 to 15
Pointer PB See memory map page 3-56 BCD, 0 to 15 See memory map
page 3-57 BCD, 0 to 15
Y2
OUT
B1400.12DirectSOFT
OUT 2 ENT
Handheld Programmer Keystrokes
STRN V 1SHFT 4 0 0
1 2 ENTK
B
Handheld Programmer Keystrokes
DirectSOFT
Y2
OUT
B1400.12
STR V 1
OUT 2
SHFT 4 0 0
1 2 ENT
ENT
K
B
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B5-12
Chapter 5: Standard RLL Instructions
Or (OR)The Or instruction logically ors a normally open contact in parallel with another contact in a rung. The status of the contact will be the same state as the associated image register point or memory location.
Or Not (ORN)The Or Not instruction logically ors a normally closed contact in parallel with another contact in a rung. The status of the contact will be opposite the state of the associated image register point or memory location.
In the following Or example, when input X1 or X2 is on, output Y5 will energize.
In the following Or Not example, when input X1 is on or X2 is off, output Y5 will energize.
Aaaa
Aaaa
�����
230
240
250-1
260
262
Operand Data Type RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
A aaa aaa aaa aaaInputs X 0-177 0-477 0-777 0-1777Outputs Y 0-177 0-477 0-777 0-1777Control Relays C 0–377 0–377 0–1777 0–3777Stage S 0–377 0–777 0–1777 0–1777Timer T 0–77 0–177 0–377 0–377Counter CT 0–77 0–177 0–177 0–377Special Relay SP 0-117, 540-577 0-137, 540-617 0-137, 540-717 0-137, 540-717Global GX - - - 0-3777Global GY - - - 0-3777
STR$
1B ENT
ORQ
2C ENT
OUTGX
5F ENT
Y5
OUT
X1
X2
Handheld Programmer KeystrokesDirectSOFT
STR$
1B ENT
2C ENT
OUTGX
5F ENT
ORNR
X1 Y5
OUT
X2
Handheld Programmer KeystrokesDirectSOFT
DS ImpliedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-13
Chapter 5: Standard RLL Instructions
Or Bit-of-Word (ORB)The Or Bit-of-Word instruction logically ors a normally open Bit-of-Word contact in parallel with another contact in a rung. Status of the contact will be the same state as the bit referenced in the associated memory location.
Or Not Bit-of-Word (ORNB)The Or Not Bit-of-Word instruction logically ors a normally closed Bit-of-Word contact in parallel with another contact in a rung. Status of the contact will be opposite the state of the bit referenced in the associated memory location.
In the following Or Bit-of-Word example, when input X1 or bit 7 of V1400 is on, output Y7 will energize.
In the following Or Not Bit-of-Word example, when input X1 is on or bit 7 of V1400 is off, output Y7 will energize.
Aaaa.bb
Aaaa.bb230
240
250-1
260
262
�����
230
240
250-1
260
262
�����
Y7
OUT
X1
B1400.7
STR 1
Handheld Programmer Keystrokes
DirectSOFT
OR V 1
OUT 7
SHFT 4 0 0
7
ENT
ENT
ENT
K
B
Y7
OUT
X1
STR 1
Handheld Programmer Keystrokes
DirectSOFT
ORN V 1
OUT 7
4 0 0
7
B1400.7
ENT
ENT
ENT
K
SHFT B
Operand Data Type D2-250-1 Range D2-260/D2-262 Range
A aaa bb aaa bb
V-memory B See memory map page 3-56 BCD, 0 to 15 See memory map
page 3-57 BCD, 0 to 15
Pointer PB See memory map page 3-56 BCD, 0 to 15 See memory map
page 3-57 BCD, 0 to 15
DS Implied
HPP Used
DL205 User Manual, 5th Edition, Rev. B5-14
Chapter 5: Standard RLL Instructions
And (AND)The AND instruction logically ands a normally open contact in series with another contact in a rung. The status of the contact will be the same state as the associated image register point or memory location.
And Not (ANDN)The And Not instruction logically “ANDs” a normally closed contact in series with another contact in a rung. The status of the contact will be opposite the state of the associated image register point or memory location.
In the following And example, when input X1 and X2 are on output Y5 will energize.
In the following And Not example, when input X1 is on and X2 is off output Y5 will energize.
Aaaa
Aaaa
�����
230
240
250-1
260
262
Operand Data Type D2-230 D2-240 D2-250-1 D2-260/D2-262Range
A aaa aaa aaa aaaInputs X 0–177 0–477 0–777 0–1777Outputs Y 0–177 0–477 0–777 0–1777Control Relays C 0–377 0–377 0–1777 0–3777Stage S 0–377 0–777 0–1777 0–1777Timer T 0–77 0–177 0–377 0–377Counter CT 0–77 0–177 0–177 0–377Special Relay SP 0-117, 540-577 0-137, 540-617 0-137, 540-717 0-137, 540-717Global GX - - - 0-3777Global GY - - - 0-3777
STR$
1B ENT
2C ENT
OUTGX
5F ENT
ANDV
Y5
OUT
X1 X2
Handheld Programmer KeystrokesDirectSOFT
ANDNW
STR$
1B ENT
2C ENT
OUTGX
5F ENT
X1 Y5
OUT
X2
Handheld Programmer KeystrokesDirectSOFT
DS ImpliedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-15
Chapter 5: Standard RLL Instructions
Aaaa.bb
Aaaa.bb
AND Bit-of-Word (ANDB)The And Bit-of-Word instruction logically ands a normally open contact in series with another contact in a rung. The status of the contact will be the same state as the bit referenced in the associated memory location.
And Not Bit-of-Word (ANDNB)The And Not Bit-of-Word instruction logically ands a normally closed contact in series with another contact in a rung. The status of the contact will be opposite the state of the bit referenced in the associated memory location.
In the following And Bit-of-Word example, when input X1 and bit 4 of V1400 is on output Y5 will energize.
In the following And Not Bit-of-Word example, when input X1 is on and bit 4 of V1400 is off, output Y5 will energize.
Operand Data Type D2-250-1 Range D2-260/D2-262 Range A aaa bb aaa bb
V-memory B See memory map page 3-56 BCD, 0 to 15 See memory map
page 3-57 BCD, 0 to 15
Pointer PB See memory map page 3-56 BCD See memory map
page 3-57 BCD
X1 Y5
OUT
B1400.4
DirectSOFT
STR 1
Handheld Programmer Keystrokes
OUT 5
ANDN V 1SHFT 4 0 0
4 ENTK
B
ENT
ENT
Y5
OUT
X1 B1400.4
DirectSOFT
OUT 5 ENT
Handheld Programmer Keystrokes
V 1SHFT 4 0 0
4 ENTK
B
STR 1 ENT
AND
DS ImpliedHPP Used
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-16
Chapter 5: Standard RLL Instructions
And Store (ANDSTR)The And Store instruction logically ands two branches of a rung in series. Both branches must begin with the Store instruction.
In the following And Store example, the branch consisting of contacts X2, X3, and X4 have been anded with the branch consisting of contact X1.
Or Store (ORSTR)The Or Store instruction logically ors two branches of a rung in parallel. Both branches must begin with the Store instruction.
In the following Or Store example, the branch consisting of X1 and X2 have been OR’d with the branch consisting of X3 and X4.
1 2
OUT
STR$
1B ENT
STR$ ENT2
C
ANDV ENT3
D
ORQ ENT4
E
ANDSTL ENT
OUTGX
5F ENT
Y5
OUT
X1 X2
X4
X3
Handheld Programmer KeystrokesDirectSOFT
�����
230
240
250-1
260
262
�����
230
240
250-1
260
262
DS ImpliedHPP Used
STR$
1B ENT
STR$ ENT
ANDV ENT
OUTGX
5F ENT
2C
3D
ANDV ENT4
E
ORSTM ENT
Y5
OUT
X1 X2
X3 X4
Handheld Programmer KeystrokesDirectSOFT
DS ImpliedHPP Used
1
2
OUT
DL205 User Manual, 5th Edition, Rev. B 5-17
Chapter 5: Standard RLL Instructions
Out (OUT)The Out instruction reflects the status of the rung (on/off) and outputs the discrete (on/off) state to the specified image register point or memory location. Multiple Out instructions referencing the same discrete location should not be used since only the last Out instruction in the program will control the physical output point. Instead, use the next instruction, the Or Out.
In the following Out example, when input X1 is on, output Y2 and Y5 will energize.
In the following Out example, the program contains two Out instructions using the same location (Y10). The physical output of Y10 is ultimately controlled by the last rung of logic referencing Y10. X1 will override the Y10 output being controlled by X0. To avoid this situation, multiple outputs using the same location should not be used in programming. If you need to have an output controlled by multiple inputs, see the OROUT instruction on page 5–19.
AaaaOUT
�����
230
240
250-1
260
262
DS UsedHPP Used
Operand Data Type RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
A aaa aaa aaa aaaInputs X 0–177 0–477 0–777 0–1777Outputs Y 0–177 0–477 0–777 0–1777Control Relays C 0–377 0–377 0–1777 0–3777Global GX - - - 0–3777Global GY - - - 0–3777
Y10
OUT
X0
Y10
OUT
X1
STR$
1B ENT
OUTGX
2C ENT
OUTGX ENT5
F
Y2
OUT
X1
Y5
OUT
Handheld Programmer KeystrokesDirectSOFT
DL205 User Manual, 5th Edition, Rev. B5-18
Chapter 5: Standard RLL Instructions
Out Bit-of-Word (OUTB)The Out Bit-of-Word instruction reflects the status of the rung (on/off) and outputs the discrete (on/off) state to the specified bit in the referenced memory location. Multiple Out Bit-of-Word instructions referencing the same bit of the same word generally should not be used since only the last Out instruction in the program will control the status of the bit.
In the following Out Bit-of-Word example, when input X1 is on, bit 3 of V1400 and bit 6 of V1401 will turn on.
The following Out Bit-of-Word example contains two Out Bit-of-Word instructions using the same bit in the same memory word. The final state bit 3 of V1400 is ultimately controlled by the last rung of logic referencing it. X1 will override the logic state controlled by X0. To avoid this situation, multiple outputs using the same location must not be used in programming.
Aaaa.bbOUT
Operand Data Type D2-250-1 Range D2-260/D2-262 Range A aaa bb aaa bb
V-memory B See memory map page 3-56 BCD, 0 to 15 See memory map
page 3-57 BCD, 0 to 15
Pointer PB See memory map page 3-56 BCD See memory map
page 3-57 BCD
B1400.3
OUT
X1
B1401.6
OUT
DirectSOFT
STR 1
Handheld Programmer Keystrokes
OUT V 1SHFT 4 0 0
3 ENTK
B
ENT
OUT V 1SHFT 4 0 1
6 ENTK
B
location must not be used in programming.
B1400.3
OUT
X0
B1400.3
OUT
X1
230
240
250-1
260
262
�����
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-19
Chapter 5: Standard RLL Instructions
Or Out (OROUT)The Or Out instruction allows more than one rung of discrete logic to control a single output. Multiple Or Out instructions referencing the same output coil may be used, since all contacts controlling the output are logically OR’d together. If the status of any rung is on, the output will also be on.
In the following example, when X1 or X4 is on, Y2 will energize.
Not (NOT)The Not instruction inverts the status of the rung at the point of the instruction.
In the following example, when X1 is off, Y2 will energize. This is because the Not instruction inverts the status of the rung at the Not instruction.
A aaaOR OUT
�����
230
240
250-1
260
262
Operand Data Type RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
A aaa aaa aaa aaaInputs X 0–177 0–477 0–777 0–1777Outputs Y 0-177 0-477 0-777 0-1777Control Relays C 0–377 0–377 0–1777 0–3777Global GX - - - 0–3777Global GY - - - 0–3777
Y2
OUT
X1
Handheld Programmer KeystrokesDirectSOFT
STR$
1B ENT
SHFT TMRN
INST#O
MLRT ENT
OUTGX
2C ENT
230
240
250-1
260
262
�����
STR$
1B ENT
STR$ ENT4
E
Y2
OR OUT
X1
Y2
OR OUT
X4
Handheld Programmer KeystrokesDirectSOFT
INST#O
5F
3D ENT ENT 2
C ENT
2C ENTINST#
O5
F3
D ENT ENT
DS UsedHPP Used
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B5-20
Chapter 5: Standard RLL Instructions
Positive Differential (PD)The Positive Differential instruction is typically known as a one shot. When the input logic produces an off-to-on transition, the output will energize for one CPU scan.
In the following example, every time X1 makes an off to on transition, C0 will energize for one scan.
NOTE: To generate a “one–shot” pulse on an on–to–off transition, place a NOT instruction immediately before the PD instruction. The D2-250–1, D2-260 and D2-262 CPUs support the STRND instruction.
STR$
1B ENT
SHFT CVP
3DSHFT 0
A ENT
C0
PD
X1
Handheld Programmer KeystrokesDirectSOFT
A aaaPD
�����
230
240
250-1
260
262
Operand Data Type RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
A aaa aaa aaa aaaInputs X 0–177 0–477 0–777 0–1777Outputs Y 0–177 0–477 0–777 0–1777Control Relays C 0–377 0–377 0–1777 0–3777
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-21
Chapter 5: Standard RLL Instructions
Store Positive Differential (STRPD)The Store Positive Differential instruction begins a new rung or an additional branch in a rung with a contact. The contact closes for one CPU scan when the state of the associated image register point makes an off-to-on transition. Thereafter, the contact remains open until the next off-to-on transition (the symbol inside the contact represents the transition). This function is sometimes called a “one-shot.” ‘This contact will also close on a program-to-run transition if it is within a retentive range and on before the PLC mode transition.
Store Negative Differential (STRND)The Store Negative Differential instruction begins a new rung or an additional branch in a rung with a contact. The contact closes for one CPU scan when the state of the associated image register point makes an on-to-off transition. Thereafter, the contact remains open until the next on-to-off transition (the symbol inside the contact represents the transition).
In the following example, each time X1 is makes an off-to-on transition, Y4 will energize for one scan.
In the following example, each time X1 makes an on-to-off transition, Y4 will energize for one scan.
Aaaa
Aaaa
Operand Data Type D2-250-1 Range D2-260/D2-262 Range A aaa aaaInputs X 0–777 0–1777Outputs Y 0–777 0–1777Control Relays C 0–1777 0–3777Stage S 0–1777 0–1777Timer T 0–377 0–377Counter CT 0–177 0–377Global GX – 0–3777Global GY – 0–3777
Y4
OUT
DirectSOFT
X1 STR$
CVP
ENTOUTGX
3DSHFT 1
B ENT
Handheld Programmer Keystrokes
4E
Y4
OUT
DirectSOFT
X1STR
$TMR
N
ENTOUTGX
3DSHFT 1
B ENT
Handheld Programmer Keystrokes
4E
230
240
250-1
260
262
�����
230
240
250-1
260
262
�����
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B5-22
Chapter 5: Standard RLL Instructions
Or Positive Differential (ORPD)The Or Positive Differential instruction logically ORs a contact in parallel with another contact in a rung. The status of the contact will be open until the associated image register point makes an off-to-on transition, closing it for one CPU scan. Thereafter, it remains open until another off-to-on transition.
Or Negative Differential (ORND)The Or Negative Differential instruction logically ORs a contact in parallel with another contact in a rung. The status of the contact will be open until the associated image register point makes an on-to-off transition, closing it for one CPU scan. Thereafter, it remains open until another on-to-off transition.
In the following example, Y5 will energize whenever X1 is on, or for one CPU scan when X2 transitions from off to on.
In the following example, Y5 will energize whenever X1 is on, or for one CPU scan when X2 transitions from on to off.
Aaaa
Aaaa
230
240
250-1
260
262
�����
Operand Data Type D2-250-1 Range D2-260/D2-262 Range A aaa aaaInputs X 0–777 0–1777Outputs Y 0–777 0–1777Control Relays C 0–1777 0–3777Stage S 0–1777 0–1777Timer T 0–377 0–377Counter CT 0–177 0–377Global GX – 0–3777Global GY – 0–3777
Y5
OUT
X1
DirectSOFT
X2
STR$
CVP
ENTOUTGX
3DSHFT
1B ENT
Handheld Programmer Keystrokes
5F
ORQ
2C ENT
X1 Y5
OUT
DirectSOFT
X2
STR$
TMRN
ENTOUTGX
3DSHFT
1B ENT
Handheld Programmer Keystrokes
5F
ORQ
2C ENT
DS ImpliedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-23
Chapter 5: Standard RLL Instructions
And Positive Differential (ANDPD)The And Positive Differential instruction logically ANDs a normally open Positive Differential contact in series with another contact in a rung. The status of the contact will be open until the associated image register point makes an off-to-on transition, closing it for one CPU scan. Thereafter, it remains open until another off-to-on transition.
And Negative Differential (ANDND)The And Negative Differential instruction logically ANDs a normally open Negative Differential contact in series with another contact in a rung. The status of the contact will be open until the associated image register point makes an on-to-off transition, closing it for one CPU scan. Thereafter, it remains open until another on-to-off transition.
In the following example, Y5 will energize for one CPU scan whenever X1 is on and X2 transitions from off to on.
In the following example, Y5 will energize for one CPU scan whenever X1 is on and X2 transitions from on to off.
230
240
250-1
260
262
�����
Aaaa
Aaaa
Y5
OUT
X1
DirectSOFT
X2 STR$
CVP
ENTOUTGX
3DSHFT
1B ENT
Handheld Programmer Keystrokes
5F
ANDV
2C ENT
X1 Y5
OUT
DirectSOFT
X2 STR$
TMRN
ENTOUTGX
3DSHFT
1B ENT
Handheld Programmer Keystrokes
5F
ANDV
2C ENT
Operand Data Type D2-250-1 Range D2-260/D2-262 Range A aaa aaaInputs X 0–777 0–1777Outputs Y 0–777 0–1777Control Relays C 0–1777 0–3777Stage S 0–1777 0–1777Timer T 0–377 0–377Counter CT 0–177 0–377Global GX – 0–3777Global GY – 0–3777
DS ImpliedHPP Used
DL205 User Manual, 5th Edition, Rev. B5-24
Chapter 5: Standard RLL Instructions
Set (SET)The Set instruction sets or turns on an image register point/memory location or a consecutive range of image register points/memory locations. Once the point/location is set, it will remain on until it is reset using the Reset instruction. It is not necessary for the input controlling the Set instruction to remain on.
Reset (RST)The Reset instruction resets or turns off an image register point/memory location or a range of image registers points/memory locations. Once the point/location is reset, it is not necessary for the input to remain on.
NOTE: You cannot set inputs (Xs) that are assigned to input modules
In the following example, when X1 is on, Y2 through Y5 will energize.
In the following example, when X2 is on, Y2 through Y5 will be reset or de–energized.
A aaaSET
aaa
Optional memory range
A aaaRST
aaa
OptionalMemory range.
�����
230
240
250-1
260
262
Operand Data Type RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
A aaa aaa aaa aaaInputs X 0–177 0–477 0–777 0–1777Outputs Y 0-177 0-477 0-777 0-1777Control Relays C 0–377 0–377 0–1777 0–3777Stage S 0-377 0-777 0-1777 0-1777Timer* T 0-77 0-177 0-377 0-377Counter * CT 0-77 0-177 0-177 0-377Global GX - - - 0–3777Global GY - - - 0–3777* Timer and counter operand data types are not valid using the Set instruction
SET
X1 Y2 Y5
Handheld Programmer KeystrokesDirectSOFT
STR$
1B ENT
SETX ENT2
C5
F
DS UsedHPP Used
STR$
2C ENT
RSTS
2C
RST
X2 Y2 Y5
Handheld Programmer KeystrokesDirectSOFT
ENT5F
DL205 User Manual, 5th Edition, Rev. B 5-25
Chapter 5: Standard RLL Instructions
Set Bit-of-Word (SETB)The Set Bit-of-Word instruction sets or turns on a bit in a V-memory location. Once the bit is set, it will remain on until it is reset using the Reset Bit-of-Word instruction. It is not necessary for the input controlling the Set Bit-of-Word instruction to remain on.
Reset Bit-of-Word (RSTB)The Reset Bit-of-Word instruction resets or turns off a bit in a V-memory location. Once the bit is reset, it is not necessary for the input to remain on.
In the following example, when X1 turns on, bit 1 in V1400 is set to the on state.
In the following example, when X2 turns on, bit 1 in V1400 is reset to the off state.
Aaaa.bbSET
A aaa.bbRST
230
240
250-1
260
262
�����
DS UsedHPP Used
SET
X1 B1400.1
DirectSOFT
STR 1
Handheld Programmer Keystrokes
SET V 1SHFT 4 0 0
1 ENTK
B
ENT
RST
X2 B1400.1
DirectSOFT
Handheld Programmer Keystrokes
STR 2
RST V 1SHFT 4 0 0
1 ENTK
B
ENT
Operand Data Type D2-250-1 Range D2-260/D2-262 Range A aaa bb aaa bb V-memory B See memory map BCD, 0 to 15 See memory map BCD, 0 to 15Pointer PB See memory map BCD See memory map BCD
DL205 User Manual, 5th Edition, Rev. B5-26
Chapter 5: Standard RLL Instructions
Pause (PAUSE)The Pause instruction disables the output update on a range of outputs. The ladder program will continue to run and update the image register; however, the outputs in the range specified in the Pause instruction will be turned off at the output points.
In the following example, when X1 is ON, Y5–Y7 will be turned OFF. The execution of the ladder program will not be affected.
Since the D2–HPP Handheld Programmer does not have a specific Pause key, you can use the corresponding instruction number for entry (#960) or type each letter of the command.
In some cases, you may want certain output points in the specified pause range to operate normally. In that case, use Aux 58 to override the Pause instruction.
aaaaaaY
PAUSE
�����
230
240
250-1
260
262
DirectSOFT
PAUSE
X1 Y5 Y7
STR$
1B ENT
Handheld Programmer Keystrokes
7H ENT
INST#O
9J
6G
0A ENT ENT
5F
Operand Data Type RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
aaa aaa aaa aaaOutputs Y 0-177 0-477 0-777 0-1777
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-27
Chapter 5: Standard RLL Instructions
Comparative BooleanStore If Equal (STRE)
The Store If Equal instruction begins a new rung or additional branch in a rung with a normally open comparative contact. The contact will be ON when Aaaa equals Bbbb .
Store If Not Equal (STRNE)The Store If Not Equal instruction begins a new rung or additional branch in a rung with a normally closed comparative contact. The contact will be ON when Aaaa does not equal Bbbb.
In the following example, when the value in V-memory location V2000 = 4933 , Y3 will energize.
In the following example, when the value in V-memory location V2000 /= 5060, Y3 will energize.
A aaa B bbb
A aaa B bbb
Y3
OUT
V2000 K5060
DirectSOFT Handheld Programmer Keystrokes
SHFT
OUTGX ENT3
D
4E
2C
0A
0A
0A
STRNSP
5F
0A ENT6
G0
A
V2000 K4933 Y3
OUT
DirectSOFT Handheld Programmer Keystrokes
STR$ SHFT 4
E2
C0
A0
A0
A
4E
9J
3D
3D ENT
OUTGX ENT3
D
Operand Data Type
RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
A/B aaa bbb aaa bbb aaa bbb aaa bbb
V-memory VAll. (See
memory map page 3-54)
All. (See memory map page 3-54)
All. (See memory map page 3-55)
All. (See memory map page 3-55)
All. (See memory map page 3-55)
All. (See memory map page 3-56)
All. (See memory map page 3-57)
All. (See memory map page 3-57)
Pointer P – – – All. (See
memory map page 3-55)
– All. (See
memory map page 3-56)
– All. (See
memory map page 3-57)
Constant K – 0-FFFF – 0-FFFF – 0-FFFF – 0-FFFF
�����
230
240
250-1
260
262
DS ImpliedHPP Used
DL205 User Manual, 5th Edition, Rev. B5-28
Chapter 5: Standard RLL Instructions
Or If Equal (ORE)The Or If Equal instruction connects a normally open comparative contact in parallel with another contact. The contact will be on when Aaaa equals Bbbb.
Or If Not Equal (ORNE)The Or If Not Equal instruction connects a normally closed comparative contact in parallel with another contact. The contact will be on when Aaaa does not equal Bbbb.
In the following example, when the value in V-memory location V2000 = 4500 or V2202 = 2345, Y3 will energize.
In the following example, when the value in V-memory location V2000 = 3916 or V2002 /= 2500, Y3 will energize.
A aaa B bbb
A aaa B bbb
2C
5F ENT0
A0
A
3D
9J ENT1
B6
G
4E
Y3
OUT
V2000 K3916
V2002 K2500
DirectSOFT Handheld Programmer Keystrokes
STR$ SHFT 2
C0
A0
A0
A
ORNR SHFT 4
E2
C0
A0
A2
C
OUTGX ENT3
D
2C
3D
4E
5F ENT
4E
5F ENT0
A0
A
Y3
OUT
V2002 K2345
V2000 K4500
DirectSOFT Handheld Programmer Keystrokes
SHFT 4E
2C
0A
0A
0A
STR$
ORQ SHFT 4
E2
C0
A0
A2
C
OUTGX ENT3
D
Operand Data Type
RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
A/B aaa bbb aaa bbb aaa bbb aaa bbb
V-memory V All. (See
memory map page 3-54)
All. (See memory map page 3-54)
All. (See memory map page 3-55)
All. (See memory map page 3-55)
All. (See memory map page 3-56)
All. (See memory map page 3-56)
All. (See memory map page 3-57)
All. (See memory map page 3-57)
Pointer P – – – All. (See
memory map page 3-55)
– All. (See
memory map page 3-56)
– All. (See
memory map page 3-57)
Constant K – 0-FFFF – 0-FFFF – 0-FFFF – 0-FFFF
�����
230
240
250-1
260
262
DS ImpliedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-29
Chapter 5: Standard RLL Instructions
And If Equal (ANDE)The And If Equal instruction connects a normally open comparative contact in series with another contact. The contact will be on when Aaaa equals Bbbb.
And If Not Equal (ANDNE)The And If Not Equal instruction connects a normally closed comparative contact in series with another contact. The contact will be on when Aaaa does not equal Bbbb
In the following example, when the value in V-memory location V2000 = 5000 and V2002 = 2345, Y3 will energize.
In the following example, when the value in V-memory location V2000 = 5000 and V2002 /= 2345, Y3 will energize.
Operand Data Type
RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
A/B aaa bbb aaa bbb aaa bbb aaa bbb
V-memory V All. (See
memory map page 3-54)
All. (See memory map page 3-54)
All. (See memory map page 3-55)
All. (See memory map page 3-55)
All. (See memory map page 3-56)
All. (See memory map page 3-56)
All. (See memory map page 3-57)
All. (See memory map page 3-57)
Pointer P – – – All. (See
memory map page 3-55)
– All. (See
memory map page 3-56)
– All. (See
memory map page 3-57)
Constant K – 0-FFFF – 0-FFFF – 0-FFFF – 0-FFFF
�����
230
240
250-1
260
262
A aaa B bbb
A aaa B bbb
2C
3D
4E
5F ENT
5F
0A ENT0
A0
A
2C
STR$ SHFT 4
E0
A0
A0
A
ANDV SHFT 4
E2
C0
A0
A2
C
OUTGX ENT3
D
Y3
OUT
V2002 K2345V2000 K5000
DirectSOFT Handheld Programmer Keystrokes
2C
3D
4E
5F ENT
5F
0A ENT0
A0
A
2C
STR$ SHFT 4
E0
A0
A0
A
ANDNW SHFT 4
E2
C0
A0
A2
C
OUTGX ENT3
D
Y3
OUT
V2002 K2345V2000 K5000
DirectSOFT Handheld Programmer Keystrokes
DS ImpliedHPP Used
DL205 User Manual, 5th Edition, Rev. B5-30
Chapter 5: Standard RLL Instructions
Store (STR)The Comparative Store instruction begins a new rung or additional branch in a rung with a normally open comparative contact. The contact will be on when Aaaa is equal to or greater than Bbbb.
Store Not (STRN)The Comparative Store Not instruction begins a new rung or additional branch in a rung with a normally open comparative contact. The contact will be on when Aaaa is less than Bbbb.
In the following example, when the value in V-memory location V2000 M 1000, Y3 will energize.
In the following example, when the value in V-memory location V2000 < 4050, Y3 will energize.
A aaa B bbb
A aaa B bbb
ENT3D
Y3
OUT
V2000 K1000
DirectSOFT Handheld Programmer Keystrokes
STR$
ENT
OUTGX
SHFT ANDV
2C
0A
0A
0A
1B
0A
0A
0A
ENT3D
0A ENT0
A4
E5
F
Y3
OUT
V2000 K4050
DirectSOFT Handheld Programmer Keystrokes
OUTGX
STRNSP SHFT AND
V2
C0
A0
A0
A
�����
230
240
250-1
260
262
DS ImpliedHPP Used
Operand Data Type
RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
A/B aaa bbb aaa bbb aaa bbb aaa bbb
V-memory V All. (See
memory map page 3-54)
All. (See memory map page 3-54)
All. (See memory map page 3-55)
All. (See memory map page 3-55)
All. (See memory map page 3-56)
All. (See memory map page 3-56)
All. (See memory map page 3-57)
All. (See memory map page 3-57)
Pointer P – – – All. (See
memory map page 3-55)
– All. (See
memory map page 3-56)
– All. (See
memory map page 3-57)
Constant K – 0-FFFF – 0-FFFF – 0-FFFF – 0-FFFF
DL205 User Manual, 5th Edition, Rev. B 5-31
Chapter 5: Standard RLL Instructions
Or (OR)The Comparative Or instruction connects a normally open comparative contact in parallel with another contact. The contact will be on when Aaaa is equal to or greater than Bbbb.
Or Not (ORN)The Comparative Or Not instruction connects a normally open comparative contact in parallel with another contact. The contact will be on when Aaaa is less than Bbbb.
In the following example, when the value in V-memory location V2000 = 6045 or V2002 M 2345, Y3 will energize.
In the following example when the value in V-memory location V2000 = 1000 or V2002 < 2500, Y3 will energize.
�����
230
240
250-1
260
262
A aaa B bbb
A aaa B bbb
2C
3D
4E
5F ENT
6G
0A
Y3
OUT
V2000 K6045
V2002 K2345
DirectSOFT Handheld Programmer Keystrokes
SHFT 4E
2C
0A
0A
0A
ENT
STR$
ORQ
OUTGX ENT3
D
4E
5F
SHFT ANDV
2C
0A
0A
2C
ENT3D
2C
5F ENT0
A0
A
ENT1B
0A
0A
0A
4E
Y3
OUT
V2000 K1000
V2002 K2500
DirectSOFT Handheld Programmer Keystrokes
STR$ SHFT 2
C0
A0
A0
A
ORNR
OUTGX
SHFT ANDV
2C
0A
0A
2C
DS ImpliedHPP Used
Operand Data Type
RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
A/B aaa bbb aaa bbb aaa bbb aaa bbb
V-memory V All. (See
memory map page 3-54)
All. (See memory map page 3-54)
All. (See memory map page 3-55)
All. (See memory map page 3-55)
All. (See memory map page 3-56)
All. (See memory map page 3-56)
All. (See memory map page 3-57)
All. (See memory map page 3-57)
Pointer P – – – All. (See
memory map page 3-55)
– All. (See
memory map page 3-56)
– All. (See
memory map page 3-57)
Constant K – 0-FFFF – 0-FFFF – 0-FFFF – 0-FFFF
DL205 User Manual, 5th Edition, Rev. B5-32
Chapter 5: Standard RLL Instructions
And (AND)The Comparative And instruction connects a normally open comparative contact in series with another contact. The contact will be on when Aaaa is equal to or greater than Bbbb.
And Not (ANDN)The Comparative And Not instruction connects a normally open comparative contact in series with another contact. The contact will be on when Aaaa < Bbbb.
In the following example, when the value in V-memory location V2000 = 5000, and V2002 M 2345, Y3 will energize.
In the following example, when the value in V-memory location V2000 = 7000 and V2002 < 2500, Y3 will energize.
A aaa B bbb
A aaa B bbb
ENT3D
2C
3D
4E
5F ENT
ENT0A
0A
5F
0A
2CY3
OUT
V2000 K5000 V2002 K2345
DirectSOFT Handheld Programmer Keystrokes
STR$ SHFT 4
E0
A0
A0
A
ANDV
OUTGX
SHFT ANDV
2C
0A
0A
2C
2C
5F ENT0
A0
A
7H ENT0
A0
A0
A
2C
Y3
OUT
V2000 K7000 V2002 K2500
DirectSOFT Handheld Programmer Keystrokes
STR$ SHFT 4
E2
C0
A0
A0
A
ANDNW
OUTGX ENT3
D
SHFT ANDV
2C
0A
0A
�����
230
240
250-1
260
262
DS ImpliedHPP Used
Operand Data Type
RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
A/B aaa bbb aaa bbb aaa bbb aaa bbb
V-memory V All. (See
memory map page 3-54)
All. (See memory map page 3-54)
All. (See memory map page 3-55)
All. (See memory map page 3-55)
All. (See memory map page 3-56)
All. (See memory map page 3-56)
All. (See memory map page 3-57)
All. (See memory map page 3-57)
Pointer P – – – All. (See
memory map page 3-55)
– All. (See
memory map page 3-56)
– All. (See
memory map page 3-57)
Constant K – 0-FFFF – 0-FFFF – 0-FFFF – 0-FFFF
DL205 User Manual, 5th Edition, Rev. B 5-33
Chapter 5: Standard RLL Instructions
Immediate InstructionsStore Immediate (STRI)
The Store Immediate instruction begins a new rung or additional branch in a rung. The status of the contact will be the same as the status of the associated input point at the time the instruction is executed. The image register is not updated.
Store Not Immediate (STRNI)The Store Not Immediate instruction begins a new rung or additional branch in a rung. The status of the contact will be opposite the status of the associated input point at the time the instruction is executed. The image register is not updated.
In the following example, when X1 is on, Y2 will energize.
In the following example, when X1 is off, Y2 will energize.
aaaX
aaaX
�����
230
240
250-1
260
262
ENT2C
1B ENTX1 Y2
OUT
Handheld Programmer KeystrokesDirectSOFT
STR$ SHFT 8
I
OUTGX
Operand Data Type RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
aaa aaa aaa aaaInputs X 0–177 0–477 0–777 0–1777
ENT2C
1B ENT
X1 Y2
OUT
Handheld Programmer KeystrokesDirectSOFT
STRNSP SHFT 8
I
OUTGX
DS ImpliedHPP Used
DL205 User Manual, 5th Edition, Rev. B5-34
Chapter 5: Standard RLL Instructions
Or Immediate (ORI)The Or Immediate connects two contacts in parallel. The status of the contact will be the same as the status of the associated input point at the time the instruction is executed. The image register is not updated.
Or Not Immediate (ORNI)The Or Not Immediate connects two contacts in parallel. The status of the contact will be opposite the status of the associated input point at the time the instruction is executed. The image register is not updated.
In the following example, when X1 or X2 is on, Y5 will energize.
In the following example, when X1 is on or X2 is off, Y5 will energize.
aaaX
aaaX
�����
230
240
250-1
260
262
1B ENT
ENT2C
ENT5F
X1
X2
Y5
OUT
Handheld Programmer KeystrokesDirectSOFT
STR$
ORQ SHFT 8
I
OUTGX
ENT5F
ENT2C
1B ENT
X1
X2
Y5
OUT
Handheld Programmer KeystrokesDirectSOFT
STR$
SHFT 8I
ORNR
OUTGX
DS ImpliedHPP Used
Operand Data Type RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
aaa aaa aaa aaaInputs X 0–177 0–477 0–777 0–1777
DL205 User Manual, 5th Edition, Rev. B 5-35
Chapter 5: Standard RLL Instructions
And Immediate (ANDI)The And Immediate connects two contacts in series. The status of the contact will be the same as the status of the associated input point at the time the instruction is executed. The image register is not updated.
And Not Immediate (ANDNI)The And Not Immediate connects two contacts in series. The status of the contact will be opposite the status of the associated input point at the time the instruction is executed. The image register is not updated.
In the following example, when X1 and X2 are on, Y5 will energize.
In the following example, when X1 is on and X2 is off, Y5 will energize.
�����
230
240
250-1
260
262
aaaX
aaaX
OUTGX
X1 X2 Y5
OUT
Handheld Programmer KeystrokesDirectSOFT
STR$
1B ENT
ANDV SHFT 8
I ENT2C
ENT5F
X1 X2 Y5
OUT
Handheld Programmer KeystrokesDirectSOFT
STR$
ANDNW SHFT 8
I
OUTGX
1B ENT
ENT2C
ENT5F
DS ImpliedHPP Used
Operand Data Type RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
aaa aaa aaa aaaInputs X 0–177 0–477 0–777 0–1777
DL205 User Manual, 5th Edition, Rev. B5-36
Chapter 5: Standard RLL Instructions
Out Immediate (OUTI)The Out Immediate instruction reflects the status of the rung (on/off) and outputs the discrete (on/off) status to the specified module output point and the image register at the time the instruction is executed. If multiple Out Immediate instructions referencing the same discrete point are used, it is possible for the module output status to change multiple times in a CPU scan. See Or Out Immediate.
Or Out Immediate (OROUTI)The Or Out Immediate instruction has been designed to use more than one rung of discrete logic to control a single output. Multiple Or Out Immediate instructions referencing the same output coil may be used, since all contacts controlling the output are ORed together. If the status of any rung is on at the time the instruction is executed, the output will also be on.
In the following example, when X1 is on, output point Y2 on the output module will turn on. For instruction entry on the Handheld Programmer, you can use the instruction number (#350) as shown, or type each letter of the command.
In the following example, when X1 or X4 is on, Y2 will energize.
Y aaa
OUTI
OROUTI
Y aaa
230
240
250-1
260
262
�����
�����
230
240
250-1
260
262
1B ENTX1 Y2
OUTI
DirectSOFT Handheld Programmer Keystrokes
STR$
INST#O
6G
3D
0A ENT ENT
2C ENT
STR$
X1
X4
Y2
OR OUTI
Y2
OR OUTI
DirectSOFT Handheld Programmer Keystrokes
STR$
1B ENT
ENT4E
INST#O
5F
3D
0A ENT ENT
2C ENT
INST#O
5F
3D
0A ENT ENT
2C ENT
DS UsedHPP Used
Operand Data Type RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
aaa aaa aaa aaaOutputs Y 0–177 0–477 0–777 0–1777
DL205 User Manual, 5th Edition, Rev. B 5-37
Chapter 5: Standard RLL Instructions
Out Immediate Formatted (OUTIF)The Out Immediate Formatted instruction outputs a 1 to 32 bit binary value from the accumulator to specified output points at the time the instruction is executed. Accumulator bits that are not used by the instruction are set to zero.
In the following example, when C0 is on,the binary pattern for X10 –X17 is loaded into the accumulator using the Load Immediate Formatted instruction. The binary pattern in the accumulator is written to Y30–Y37 using the Out Immediate Formatted instruction. This technique is useful to quickly copy an input pattern to outputs (without waiting for the CPU scan).
bbbKY aaaOUTIF�
����
230
240
250-1
260
262
DS UsedHPP Used
Operand Data Type D2-260/D2-262 Range aaa bbb
Outputs Y 0–1777 –Constant K – 1–32
LDIF X10 CO
K8
K8X10
0 0 0 0 0 0 0 0 1 0 1 1 0 1 0 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
K8Y30
X10X11X12X13X14X15X16X17ONOFFONOFFONONOFFON
Y30Y31Y32Y33Y34Y35Y36Y37ONOFFONOFFONONOFFON
K8
Load the value of 8 consecutive locations into theaccumulator, starting with X10.
OUTIF Y30
Copy the value in the lower8 bits of the accumulator toY30-Y37
DirectSOFT
Unused accumulator bits are set to zero
Location Constant
Acc.
Location Constant
OUTGX
Handheld Programmer Keystrokes
STR$
0A ENT
5F
3D
0A
3D
ANDSTL
8I ENT
ENT
NEXT NEXT NEXT NEXT
SHFT5
F1
B0
A8
I
SHFT8
I8
I
DL205 User Manual, 5th Edition, Rev. B5-38
Chapter 5: Standard RLL Instructions
Set Immediate (SETI)The Set Immediate instruction immediately sets or turns on an output or a range of outputs in the image register and the corresponding output point(s) at the time the instruction is executed. Once the outputs are set, it is not necessary for the input to remain on. The Reset Immediate instruction can be used to reset the outputs.
Reset Immediate (RSTI)The Reset Immediate instruction immediately resets or turns off an output or a range of outputs in the image register and the output point(s) at the time the instruction is executed. Once the outputs are reset, it is not necessary for the input to remain on.
In the following example, when X1 is on, Y2 through Y5 will be set on in the image register and on the corresponding output points.
In the following example, when X1 is on, Y5 through Y22 will be reset (off) in the image register and on the corresponding output module(s).
aaaY aaaSETI
aaaY aaaRSTI
�����
230
240
250-1
260
262
�����
230
240
250-1
260
262
1B ENTX1 Y2
SETI
Y5
DirectSOFT Handheld Programmer Keystrokes
STR$
SETX SHFT 8
I ENT2C
5F
1B ENT
X1 Y5
RSTI
Y22
DirectSOFTHandheld Programmer Keystrokes
STR$
SHFT 8I
5F
2C
2C ENTRST
S
DS UsedHPP Used
Operand Data Type RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
aaa aaa aaa aaaOutputs Y 0–177 0–477 0–777 0–1777
DL205 User Manual, 5th Edition, Rev. B 5-39
Chapter 5: Standard RLL Instructions
Load Immediate (LDI)The Load Immediate instruction loads a 16-bit V-memory value into the accumulator. The valid address range includes all input point addresses on the local base. The value reflects the current status of the input points at the time the instruction is executed. This instruction may be used instead of the LDIF instruction, which requires you to specify the number of input points.
In the following example, when C0 is on, the binary pattern of X0–X17 will be loaded into the accumulator using the Load Immediate instruction. The Out Immediate instruction could be used to copy the 16 bits in the accumulator to output points, such as Y40–Y57. This technique is useful to quickly copy an input pattern to output points (without waiting for a full CPU scan to occur).
V aaaLDI
C0
OUTI
V40400
1 0 1 1 0 1 0 0 1 0 1 1 0 1 0 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
V40502
X10X11X12X13X14X15X16X17OFFOFFONOFFONONOFFON
Y50Y51Y52Y53Y54Y55Y56Y57OFFOFFONOFFONONOFFON
X0X1X2X3X4X5X6X7ONOFFONOFFONONOFFON
Y40Y41Y42Y43Y44Y45Y46Y47ONOFFONOFFONONOFFON
LDI
V40400
V40502
Load the inputs from X0 toX17 into the accumulator,immediately
Output the value in theaccumulator to output pointsY40 to Y57
Location
Unused accumulator bitsare set to zero
Location
DirectSOFT
�����
230
240
250-1
260
262
DS UsedHPP Used
Operand Data Type D2-260/D2-262 Range aaaaa
Inputs V-memory V 40400–40477
OUTGX
Handheld Programmer Keystrokes
STR$
0A ENT
3D
ANDSTL
8I ENT
ENT
SHFT
SHFT4
E0
A
SHFT8
I
4E
0A
0A
NEXT4
E0
A5
F0
A2
C
2C
DL205 User Manual, 5th Edition, Rev. B5-40
Chapter 5: Standard RLL Instructions
Load Immediate Formatted (LDIF)The Load Immediate Formatted instruction loads a 1–32 bit binary value into the accumulator. The value reflects the current status of the input module(s) at the time the instruction is executed. Accumulator bits that are not used by the instruction are set to zero.
In the following example, when C0 is on, the binary pattern of X10–X17 will be loaded into the accumulator using the Load Immediate Formatted instruction. The Out Immediate Formatted instruction could be used to copy the specified number of bits in the accumulator to the specified outputs on the output module, such as Y30–Y37. This technique is useful to quickly copy an input pattern to outputs (without waiting for the CPU scan).
K bbbX aaaLDIF�
����
230
240
250-1
260
262
LDIF X10K8
C0
Load the value of 8consecutive location into theaccumulator starting withX10
OUTIF Y30K8
Copy the value of the lower8 bits of the accumulator toY30 --Y37
K8X10
Location Constant
0 0 0 0 0 0 0 0 1 0 1 1 0 1 0 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
K8Y30
Location Constant
X10X11X12X13X14X15X16X17ONOFFONOFFONONOFFON
Y30Y31Y32Y33Y34Y35Y36Y37ONOFFONOFFONONOFFON
Unused accumulator bitsare set to zero
DirectSOFT
s
OUTGX
Handheld Programmer Keystrokes
STR$
0A ENT
5F
3D
0A
3D
ANDSTL
8I ENT
ENT
SHFT
SHFT5
F1
B0
A8
I
SHFT8
I8
I
2C
Operand Data Type D2-260/D2-262 Range aaa bbb
Intputs X 0–1777 – Constant K – 1–32
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-41
Chapter 5: Standard RLL Instructions
Timer, Counter and Shift Register InstructionsUsing Timers
Timers are used to time an event for a desired length of time. The single input timer (TMR) will time as long as the input is on. When the input changes from on to off, the timer current value is reset to 0. There is a tenth of a second and a hundredth of a second timer available with a maximum time of 999.9 and 99.99 seconds respectively. A discrete bit is associated with each timer to indicate that the current value is equal to or greater than the preset value. The timing diagram below shows the relationship between the timer input, associated discrete bit, current value, and timer preset.
Some applications that need an accumulating timer, meaning it has the ability to time, stop, and then resume from where it previously stopped. The accumulating timer (TMRA) works similarly to the regular timer, but two inputs are required. The enable input starts and stops the timer. When the timer stops, the elapsed time is maintained. When the timer starts again, the timing continues from the elapsed time. When the reset input is turned on, the elapsed time is cleared and the timer will start at 0 when it is restarted. A tenth of a second and a hundredth of a second timers are available with a maximum time of 9999999.9 and 999999.99 seconds respectively. The timing diagram below shows the relationship between the timer input, timer reset, associated discrete bit, current value, and timer preset.
X1
X1
T0
1 2 3 4 5 6 7 80
0 10 10 20 30 40 50 0CurrentValue
TMRA T0K30
X2
X2
Reset Input
Enable
Seconds
1/10 Seconds
TMR T1K30
X1
X1
T1
1 2 3 4 5 6 7 80
0 10 20 30 40 50 60 0CurrentValue
T1 Y0OUT
Seconds
1/10 Seconds
Timer Preset
DL205 User Manual, 5th Edition, Rev. B5-42
Chapter 5: Standard RLL Instructions
Timer (TMR) and Timer Fast (TMRF)The Timer instruction is a 0.1 second single-input timer that times to a maximum of 999.9 seconds. The Timer Fast instruction is a 0.01 second single input timer that times up to a maximum of 99.99 seconds. These timers will be enabled if the input logic is true (on) and will be reset to 0 if the input logic is false (off).
Instruction Specifications
Timer Reference (Taaa): Specifies the timer number.
Preset Value (Bbbb): Constant value (K) or a V-memory location. (Pointer (P) for D2-240, D2-250–1, D2-260 and D2-262).
Current Value: Timer current values are accessed by referencing the associated V or T memory location. For example, the timer current value for T3 physically resides in V-memory location V3.
Discrete Status Bit: The discrete status bit is referenced by the associated T memory location. It will be ON if the current value is equal to or greater than the preset value. For example, the discrete status bit for Timer 2 would be T2.
NOTE: A V-memory preset is required only if the ladder program or an Operator Interface unit must change the preset.
NOTE: *Both the Timer discrete status bits and the current value are accessed with the same data reference with the HPP. DirectSOFT uses separate references, such as “T2” for discrete status bit for Timer T2, and “TA2” for the current value of Timer T2.
You can perform functions when the timer reaches the specified preset using the discrete status bit. Or, use the comparative contacts to perform functions at different time intervals based on one timer. The examples on the following page show these methods of programming timers.
T aaa
aaaTTMRB bbb
Preset Timer #
TMRFB bbb
Preset Timer #
Operand Data Type
RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
B aaa bbb aaa bbb aaa bbb aaa bbbTimers T 0-77 0-177 0-377 0-377V-memory for preset values V – 2000-2377 – 2000-3777 – 1400-7377
10000-17777 – 1400-7377 10000-37777
Pointers (presets only) P 2000-3777 1400-7377
10000-177771400-7377
10000-37777Constants (presets only) K – 0-9999 – 0-9999 – 0-9999 – 0-9999
Timer discrete status bits T/V* 0-77 or V41100-41103 0-177 or V41100-41107 0-377 or V41100-41117 0-377 or V41100-41117
Timer current values V/T* 0-77 0-177 0-377 0-377
�����
230
240
250-1
260
262
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-43
Chapter 5: Standard RLL Instructions
Timer Example Using Discrete Status BitsIn the following example, a single-input timer is used with a preset of 3 seconds. The timer discrete status bit (T2) will turn on when the timer has timed for 3 seconds. The timer is reset when X1 turns off, turning the discrete status bit off and resetting the timer current value to 0.
Timer Example Using Comparative Contacts
In the following example, a single-input timer is used with a preset of 4.5 seconds. Comparative contacts are used to energize Y3, Y4, and Y5 at one-second intervals respectively. When X1 is turned off, the timer will be reset to 0 and the comparative contacts will turn off Y3, Y4, and Y5.
STR$
TMRN
2C
STR$ SHFT MLR
T2
C ENT
OUTGX
Handheld Programmer Keystrokes
X1TMR T2
K30
T2 Y0
OUT
X1
T2
1 2 3 4 5 6 7 80
0 10 20 30 40 50 60 0CurrentValue
Y0
Timing DiagramDirectSOFT
Seconds
1B ENT
3D
0A ENT
ENT0A
1B ENT
Handheld Programmer Keystrokes
X1TMR T20
K45
TA20 K10
TA20 K20
TA20 K30
Y4
OUT
Y3
OUT
Y5
OUT
X1
Y3
1 2 3 4 5 6 7 80
0 10 20 30 40 50 60 0CurrentValue
Y4
Timing Diagram
Y5
T2
DirectSOFT
Seconds
STR$
TMRN
2C ENT0
A4
E5
F
STR$ SHFT MLR
T2
C0
A1
B ENT
OUTGX ENT3
D
STR$ SHFT MLR
T2
C0
A ENT
OUTGX ENT
2C
4E
STR$ SHFT MLR
T2
C0
A ENT
OUTGX ENT
3D
5F
0A
0A
0A
1/10th Seconds
1/10th Seconds
DL205 User Manual, 5th Edition, Rev. B5-44
Chapter 5: Standard RLL Instructions
Accumulating Timer (TMRA)The Accumulating Timer is a 0.1 second two-input timer that will time to a maximum of 9999999.9. The TMRA uses two timer registers in V-memory.
Accumulating Fast Timer (TMRAF)The Accumulating Fast Timer is a 0.01 second two-input timer that will time to a maximum of 999999.99. The TMRAF uses two timer registers in V-memory.
These timers have two inputs: an enable and a reset. The timer will start timing when the enable is on and stop timing when the enable is off without resetting the value to 0. The reset will reset the timer when on and allow the timer to time when off.
Instruction Specifications
Timer Reference (Taaa): Specifies the timer number.
Preset Value (Bbbb): Constant value (K) or two consecutive V-memory locations. (Pointer (P) for D2-240, D2-250–1, D2-260 and D2-262).Current Value: Timer current values are accessed by referencing the associated V or T memory location. For example, the timer current value for T3 resides in V-memory location V3.
Discrete Status Bit: The discrete status bit is accessed by referencing the associated T memory location. It will be on if the current value is equal to or greater than the preset value. For example, the discrete status bit for Timer 2 would be T2.
NOTE: The accumulating timer uses two consecutive V-memory locations for the 8-digit value; therefore, two consecutive timer locations. For example, if TMRA T1 is used, the next available timer number is T3.
NOTE: A V-memory preset is required only if the ladder program or an OIT must be used to change the preset.
NOTE: * Both the Timer discrete status bits and the current value are accessed with the same data reference with the HPP. DirectSOFT uses separate references, such as “T2” for discrete status bit for Timer T2, and “TA2” for the current value of Timer T2.
T aaa
T aaaTMRAB bbb
Enable
Reset
Preset
TMRAFB bbb
Enable
Reset
Preset
Timer
Timer
�����
230
240
250-1
260
262
DS UsedHPP Used
Operand Data Type
RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
B aaa bbb aaa bbb aaa bbb aaa bbbTimers T 0-77 0-177 0-377 0-377V-memory for preset values V – 2000-2377 – 2000-3777 – 1400-7377
10000-17777 – 1400-7377 10000-37777
Pointers (presets only) P 2000-3777 1400-7377
10000-177771400-7377
10000-37777Constants (presets only) K – 0-9999 – 0-9999 – 0-9999 – 0-9999
Timer discrete status bits T/V* 0-77 or V41100-41103 0-177 or V41100-41107 0-377 or V41100-41117 0-377 or V41100-41117
Timer current values V/T* 0-77 0-177 0-377 0-377
DL205 User Manual, 5th Edition, Rev. B 5-45
Chapter 5: Standard RLL Instructions
Accumulating Timer Example using Discrete Status BitsIn the following example, a two input timer (accumulating timer) is used with a preset of three seconds. The timer discrete status bit (T6) will turn on when the timer has timed for three seconds. Notice in this example that the timer times for one second, stops for one second, then resumes timing. The timer will reset when C10 turns on, turning the discrete status bit off and resetting the timer current value to zero.
Accumulator Timer Example Using Comparative ContactsIn the following example, a two-input timer is used with a preset of 4.5 seconds. Comparative contacts are used to energize Y3, Y4, and Y5 at one-second intervals respectively. The comparative contacts will turn off when the timer is reset.
Handheld Programmer Keystrokes
TA20 K10
TA21 K1
TA20 K20
Y3
OUT
Y4
OUT
X1
TMRA T20
K45C10
X1
C10
1 2 3 4 5 6 7 80
0 10 10 20 30 40 50 0CurrentValue
Timing Diagram
Y3
Y4
Y5
T20
DirectSOFT
Handheld Programmer Keystrokes (cont’d)
Seconds
ANDV SHFT4
EMLR
T
OUTGX ENT
1B
4E
STR$ SHFT
MLRT
2C
0A
OUTGX ENT
5F
STR$
1B ENT
ENT4
E5
F
STR$ SHFT
MLRT
2C
0A
1B ENT
OUTGX ENT
3D
STR$ SHFT ENT
2C
1B
0A
2C
0A
TMRN SHFT
0A
0A
0A
Contacts
TA21 K1
TA20 K30 Y5
OUT
TA21 K0
TA21 K0
TA21 K1
ORQ SHFT4
EMLR
T1
B1
B
ENT
ENT
SHFT
SHFT
2C
2C
STR$ SHFT
MLRT
2C
0A
ANDV SHFT4
EMLR
T1
B0
A
ORQ SHFT4
EMLR
T1
B1
B
ENT
ENT
SHFT
SHFT
2C
2C
ENT2
C0
A
ENT3
D0
A
ANDV SHFT4
EMLR
T1
B1
B ENTSHFT2
C
1/10th Seconds
Handheld Programmer Keystrokes
X1
T6
TMRA T6
K30C10
Y10
OUT
X1
C10
1 2 3 4 5 6 7 80
0 10 10 20 30 40 50 0CurrentValue
T6
Timing DiagramDirectSOFT
Seconds
Handheld Programmer Keystrokes (cont’d)
STR$
STR$ SHFT ENT2
C1
B0
A
TMRN SHFT 0
A
3D
0A ENT
STR$ SHFT MLR
T ENT
OUTGX ENT0
A
6G
1B
1B ENT
6G
1/10th Seconds
DL205 User Manual, 5th Edition, Rev. B5-46
Chapter 5: Standard RLL Instructions
Counter (CNT)The Counter is a two-input counter that increments when the count input logic transitions from off to on. When the counter reset input is on, the counter resets to zero. When the current value equals the preset value, the counter status bit comes on and the counter continues to count up to a maximum count of 9999. The maximum value will be held until the counter is reset.
Instruction Specifications
Counter Reference (CTaaa): Specifies the counter number.
Preset Value (Bbbb): Constant value (K) or a V-memory location. (Pointer (P) for D2-240, D2-250–1, D2-260 and D2-262.)
Current Values: Counter current values are accessed by referencing the associated V or CT memory locations. The V-memory location is the counter location + 1000. For example, the counter current value for CT3 resides in V-memory location V1003.
Discrete Status Bit: The discrete status bit is accessed by referencing the associated CT memory location. It will be on if the value is equal to or greater than the preset value. For example, the discrete status bit for Counter 2 would be CT2.
NOTE: A V-memory preset is required only if the ladder program or an OIT must used to change the preset
NOTE: * Both the Counter discrete status bits and the current value are accessed with the same data reference with the HPP. DirectSOFT uses separate references, such as “CT2” for discrete status bit for Counter CT2, and “CTA2” for the current value of Counter CT2.
CT aaaCNTB bbb
Count
Reset
Counter #
Preset
Operand Data Type
RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
B aaa bbb aaa bbb aaa bbb aaa bbbCounters CT 0-77 0-177 0-177 0-377V-memory for preset values V – 2000-2377 – 2000-3777 – 1400-7377
10000-17777 – 1400-7377 10000-37777
Pointers (presets only) P 2000-3777 1400-7377
10000-177771400-7377
10000-37777Constants (presets only) K – 0-9999 – 0-9999 – 0-9999 – 0-9999
Counter discrete status bits CT/V* 0-77 or V41140-41143 0-177 or V41140-41147 0-177 or V41140-41147 0-377 or V41100-41157
Counter current values V/CT* 1000-1077 1000-1177 1000-1177 1000-1377
�����
230
240
250-1
260
262
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-47
Chapter 5: Standard RLL Instructions
Counter Example Using Discrete Status BitsIn the following example, when X1 makes an off-to-on transition, counter CT2 will increment by one. When the current value reaches the preset value of 3, the counter status bit CT2 will turn on and energize Y7. When the reset C10 turns on, the counter status bit will turn off and the current value will be 0. The current value for counter CT2 will be held in V-memory location V1002.
Counter Example Using Comparative ContactsIn the following example, when X1 makes an off-to-on transition, counter CT2 will increment by one. Comparative contacts are used to energize Y3, Y4, and Y5 at different counts. When the reset C10 turns on, the counter status bit will turn off and the counter current value will be 0, and the comparative contacts will turn off.
2C
Handheld Programmer Keystrokes
CT2
X1
CNT CT2
K3C10
Y7
OUT
X1
CT2 orY7
1 2 3 4 0Current Value
C10
Counting diagramDirectSOFT
STR$
1B ENT
3D ENT
STR$ SHFT ENT2
C1
B0
A
CNTGY
STR$ SHFT ENT
OUTGX ENT7
H
2C
MLRT
2C
Handheld Programmer Keystrokes (cont)
SHFT
Handheld Programmer Keystrokes
X1
CNT CT2
K3C10
X1
Y3
1 2 3 4 0CurrentValue
C10
Counting diagram
CTA2 K1
CTA2 K2
CTA2 K3
Y4
OUT
Y3
OUT
Y5
OUT
Y4
Y5
DirectSOFT
Handheld Programmer Keystrokes (cont)
STR$ SHFT
ENT
OUTGX ENT
2C
4E
STR$ SHFT 2
C
ENT
OUTGX ENT
3D
5F
STR$
1B ENT
2C
STR$ SHFT
1B ENT
OUTGX ENT3
D
STR$ SHFT ENT2
C1
B0
A
CNTGY ENT3
D
MLRT
2C
2C
MLRT
2C
2C
MLRT
2CSHFT
SHFT
SHFT
DL205 User Manual, 5th Edition, Rev. B5-48
Chapter 5: Standard RLL Instructions
Stage Counter (SGCNT)The Stage Counter is a single-input counter that increments when the input logic transitions from off to on. This counter differs from other counters since it will hold its current value until reset using the RST instruction. The Stage Counter is designed for use in RLLPLUS programs but can be used in relay ladder logic programs. When the current value equals the preset value, the counter status bit turns on and the counter continues to count up to a maximum count of 9999. The maximum value will be held until the counter is reset.
Instruction Specifications
Counter Reference (CTaaa): Specifies the counter number.
Preset Value (Bbbb): Constant value (K) or a V-memory location.(Pointer (P) for D2-240, D2-250–1, D2-260 and D2-262.)
Current Values: Counter current values are accessed by referencing the associated V or CT memory locations. The V-memory location is the counter location + 1000. For example, the counter current value for CT3 resides in V-memory location V1003.
Discrete Status Bit: The discrete status bit is accessed by referencing the associated CT memory location. It will be on if the value is equal to or greater than the preset value. For example, the discrete status bit for Counter 2 would be CT2.
NOTE: When using a counter inside a stage, the stage must be active for one scan before the input to the counter makes a 0-1 transition. Otherwise, there is no real transition and the counter will not count.
NOTE: A V-memory preset is required only if the ladder program or an OIT must used to change the preset.
NOTE: * Both the Counter discrete status bits and the current value are accessed with the same data reference with the HPP. DirectSOFT uses separate references, such as “CT2” for discrete status bit for Counter CT2, and “CTA2” for the current value of Counter CT2.
CTaaaSGCNTB bbb
Preset
Counter #
�����
230
240
250-1
260
262
DS UsedHPP Used
The counter discrete status bit and the current value are not specified in the
counter instruction.
Operand Data Type
RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
B aaa bbb aaa bbb aaa bbb aaa bbbCounters CT 0-77 0-177 0-177 0-377V-memory for preset values V – 2000-2377 – 2000-3777 – 1400-7377
10000-17777 – 1400-7377 10000-37777
Pointers (presets only) P 2000-3777 1400-7377
10000-177771400-7377
10000-37777Constants (presets only) K – 0-9999 – 0-9999 – 0-9999 – 0-9999
Counter discrete status bits CT/V* 0-77 or V41140-41143 0-177 or V41140-41147 0-177 or V41140-41147 0-377 or V41100-41157
Counter current values V/CT* 1000-1077 1000-1177 1000-1177 1000-1377
DL205 User Manual, 5th Edition, Rev. B 5-49
Chapter 5: Standard RLL Instructions
Stage Counter Example Using Discrete Status BitsIn the following example, when X1 makes an off-to-on transition, stage counter CT7 will increment by one. When the current value reaches 3, the counter status bit CT7 will turn on and energize Y7. The counter status bit CT7 will remain on until the counter is reset using the RST instruction. When the counter is reset, the counter status bit will turn off and the counter current value will be 0. The current value for counter CT7 will be held in V-memory location V1007.
Stage Counter Example Using Comparative ContactsIn the following example, when X1 makes an off-to-on transition, counter CT2 will increment by one. Comparative contacts are used to energize Y3, Y4, and Y5 at different counts. Although this is not shown in the example, when the counter is reset using the Reset instruction, the counter status bit will turn off and the current value will be 0. The current value for counter CT2 will be held in V-memory location V1002.
3D
7H
Handheld Programmer Keystrokes
X1
C5 CT7
SGCNT CT7K3
RST
X1
Y7
1 2 3 4 0CurrentValue
RSTCT7
CT7 Y7
OUT
Counting diagramDirectSOFT
STR$
1B ENT
CNTGY
STR$ SHFT ENT
OUTGX ENTH
2C
MLRT
7H
STR$ SHFT ENT2
C5
F
RSTS SHFT 2
C7
H ENT
SHFT RSTS
6G SHFT
ENT
Handheld Programmer Keystrokes (cont)
SHFT
SHFT
SHFT MLRT
7
Handheld Programmer Keystrokes
X1
X1
Y3
1 2 3 4 0CurrentValue
Counting diagram
CTA2 K1
CTA2 K2
CTA2 K3
Y4
OUT
Y3
OUT
Y5
OUT
Y4
Y5
SGCNT CT2K10
DirectSOFT
Handheld Programmer Keystrokes (cont)
STR$
1B ENT
CNTGYSHFT RST
S6
G SHFT
ENT2C
1B
0A
STR$ SHFT
1B ENT
OUTGX ENT3
D
MLRT
2C
2C
STR$ SHFT
ENT
OUTGX ENT
2C
4E
STR$ SHFT 2
C
ENT
OUTGX ENT
3D
5F
MLRT
2C
2C
MLRT
2CSHFT
SHFT
SHFT
RSTCT2
DL205 User Manual, 5th Edition, Rev. B5-50
Chapter 5: Standard RLL Instructions
Up Down Counter (UDC)This Up/Down Counter counts up on each off-to-on transition of the Up input and counts down on each off to on transition of the Down input. The counter is reset to 0 when the Reset input is on. The count range is 0 to 99999999. The count input not being used must be off in order for the active count input to function.
Instruction Specification
Counter Reference (CTaaa): Specifies the counter number.
Preset Value (Bbbb): Constant value (K) or two consecutive V-memory locations. (Pointer (P) for D2-240, D2-250–1, D2-260 and D2-262).
Current Values: Current count is a double word value accessed by referencing the associated V or CT memory locations. The V-memory location is the counter location + 1000. For example, the counter current value for CT5 resides in V-memory location V1005 and V1006.
Discrete Status Bit: The discrete status bit is accessed by referencing the associated CT memory location. It will be on if the value is equal to or greater than the preset value. For example, the discrete status bit for Counter 2 would be CT2.
NOTE: The UDC uses two consecutive V-memory locations for the 8-digit value, therefore two consecutive counter locations. For example, if UDC CT1 is used, the next available counter number is CT3.
NOTE: A V-memory preset is required only if the ladder program or an OIT must be used to change the preset.
NOTE: * Both the Counter discrete status bits and the current value are accessed with the same data reference with the HPP. DirectSOFT uses separate references, such as “CT2” for discrete status bit for Counter CT2, and “CTA2” for the current value of Counter CT2.
CT aaaUDCB bbb
Up
Down
Reset
Caution: The UDC uses two V-memory locations for the 8-digitcurrent value. This means that theUDC uses two consecutivecounter locations. If UDC CT1 isused in the program, the nextavailable counter is CT3.
Preset
Counter #
Operand Data Type
RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
B aaa bbb aaa bbb aaa bbb aaa bbbCounters CT 0-76 0-176 0-176 0-376V-memory for preset values V – 2000-2377 – 2000-3777 – 1400-7377
10000-17777 – 1400-7377 10000-37777
Pointers (presets only) P 2000-3777 1400-7377
10000-177771400-7377
10000-37777Constants (presets only) K – 0-99999999 – 0-99999999 – 0-99999999 – 0-99999999
Counter discrete status bits CT/V* 0-76 or V41140-41143 0-176 or V41140-41147 0-176 or V41140-41147 0-376 or V41100-41157
Counter current values V/CT* 1000-1076 1000-1176 1000-1176 1000-1376
�����
230
240
250-1
260
262
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-51
Chapter 5: Standard RLL Instructions
Up/Down Counter Example Using Discrete Status BitsIn the following example, if X2 and X3 are off, when X1 toggles from off to on the counter will increment by one. If X1 and X3 are off, the counter will decrement by one when X2 toggles from off to on. When the count value reaches the preset value of 3, the counter status bit will turn on. When the reset X3 turns on, the counter status bit will turn off and the current value will be 0.
Up/Down Counter Example Using Comparative ContactsIn the following example, when X1 makes an off to on transition, counter CT2 will increment by one. Comparative contacts are used to energize Y3 and Y4 at different counts. When the reset (X3) turns on, the counter status bit will turn off, the current value will be 0, and the comparative contacts will turn off.
3D ENT
Handheld Programmer Keystrokes
X1UDC CT2
K3X2
X3
CT2 Y10
OUT
X1
CT2
1 2 1 2 3 0CurrentValue
X2
X3
Counting DiagramDirectSOFT
Handheld Programmer Keystrokes (cont)
STR$
1B ENT
STR$
2C
STR$
3D
SHFT ISGU
3D
2C
2C
ENT
ENT STR$ SHFT ENT
OUTGX ENT0
A1
B2
CMLR
T2
CSHFT
ANDV
Handheld Programmer Keystrokes
X1UDC CT2
V2000X2
X3
X1
X2
X3
Counting Diagram
CTA2 K1
CTA2 K2 Y4
OUT
Y3
OUTY3
1 2 3 4 0CurrentValue
Y4
DirectSOFT
Handheld Programmer Keystrokes (cont)
STR$
1B ENT
STR$
2C
STR$
3D
SHFT ISGU
3D
2C
2C
ENT
ENT
SHFT ENT2C
0A
0A
0A
STR$ SHFT
1B ENT
OUTGX ENT3
D
MLRT
2C
2C
STR$ SHFT
ENT
OUTGX ENT
MLRT
2C
2C
2C
4E
SHFT
SHFT
DL205 User Manual, 5th Edition, Rev. B5-52
Chapter 5: Standard RLL Instructions
Shift Register (SR)The Shift Register instruction shifts data through a predefined number of control relays. The control ranges in the shift register block must start at the beginning of an 8-bit boundary and use 8-bit blocks.
The Shift Register has three contacts.• Data — determines the value (1 or 0) that will enter the
register• Clock — shifts the bits one position on each low to
high transition• Reset —resets the Shift Register to all zeros.
With each off-to-on transition of the clock input, the bits which make up the shift register block are shifted by one bit position and the status of the data input is placed into the starting bit position in the shift register. The direction of the shift depends on the entry in the From and To fields. From C0 to C17 would define a block of 16 bits to be shifted from left to right. From C17 to C0 would define a block of 16 bits, to be shifted from right to left. The maximum size of the shift register block depends on the number of available control relays. The minimum block size is 8 control relays.
�����
230
240
250-1
260
262
Operand Data Type
RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
A/B aaa bbb aaa bbb aaa bbb aaa bbbControl Relay C 0-377 0-377 0-377 0-377 0-1777 0-1777 0-3777 0-3777
DS UsedHPP Used
SR
aaaFrom A
bbbTo B
DATA
CLOCK
RESET
Data Input
Clock Input
Reset Input
Shift Register Bits
C0 C17Reset
1 1 0
0 1 0
0 1 0
1 1 0
0 1 0
0 0 1
Inputs on Successive Scans
X1
X2
SR
C0From
C17X3
To
Handheld Programmer KeystrokesDirectSOFT
STR$
1B ENT
STR$
2C
STR$
3D
SHFT
ENT
ENT
RSTS
ORNR SHFT 0
A
1B
7H ENT
SHFT
Indicates ON
IndicatesOFF
Clock Data
DL205 User Manual, 5th Edition, Rev. B 5-53
Chapter 5: Standard RLL Instructions
Accumulator/Stack Load and Output Data InstructionsUsing the Accumulator
The accumulator in the DL205 series CPUs is a 32-bit register that is used as a temporary storage location for data that is being copied or manipulated in some manner. For example, you have to use the accumulator to perform math operations, such as, add, subtract, multiply, etc. Since there are 32 bits, you can use up to an 8-digit BCD number or a 32-bit 2’s compliment number. The accumulator is reset to 0 at the end of every CPU scan.
Copying Data to the AccumulatorThe Load and Out instructions and their variations are used to copy data from a V-memory location to the accumulator, or to copy data from the accumulator to V-memory. The following example copies data from V-memory location V1400 to V-memory location V1410.
Since the accumulator is 32 bits and V-memory locations are 16 bits, the Load Double and Out Double (or variations thereof) use two consecutive V-memory locations or 8-digit BCD constants to copy data either to the accumulator from a V-memory address or from a V-memory address to the accumulator. For example, if you wanted to copy data from V1400 and V1401 to V1410 and V1411, the most efficient way to perform this function would be as follows:
LD
V1400
X1
Copy data from V1400 to thelower 16 bits of theaccumulator
Copy data from the lower 16 bitsof the accumulator to V1410
OUT
V1410
V1410
Acc.
V1400
8 9 3 5
8 9 3 5
0 0 0 0 8 9 3 5
Unused accumulator bitsare set to zero
LDD
V1400
Copy data from V1400 andV1401 to the accumulator
Copy data from the accumulator toV1410 and V1411
OUTD
V1410
V1410
Acc.
V1400
5 0 2 6
5 0 2 6
6 7 3 9 5 0 2 6
X1 V1401
6 7 3 9
V1411
6 7 3 9
DL205 User Manual, 5th Edition, Rev. B5-54
Chapter 5: Standard RLL Instructions
Using the Accumulator StackThe accumulator stack is used for instructions that require more than one parameter to execute a function or for user-defined functionality. The accumulator stack is used when more than one Load instruction is executed without the use of an Out instruction. The first Load instruction in the scan places a value into the accumulator. Every Load instruction thereafter without the use of an Out instruction places a value into the accumulator and the value that was in the accumulator is placed onto the accumulator stack. The Out instruction nullifies the previous Load instruction and does not place the value that was in the accumulator onto the accumulator stack when the next Load instruction is executed. Every time a value is placed onto the accumulator stack, the other values in the stack are pushed down one location. The accumulator is eight levels deep (eight 32-bit registers). If there is a value in the eighth location when a new value is placed onto the stack, the value in the eighth location is pushed off the stack and cannot be recovered.
The POP instruction rotates values upward through the stack into the accumulator. When a POP is executed, the value that was in the accumulator is cleared and the value that was on top of the stack is in the accumulator. The values in the stack are shifted up one position in the stack.
Acc.Load the value 3245 into the accumu-lator
Load the value 5151 into the accumu-lator, pushing the value 3245 onto thestack
Load the value 6363 into the accumu-lator, pushing the value 5151 to the 1ststack location and the value 3245 tothe 2nd stack location
LD
K3245
X1
LD
K5151
LD
K6363
Constant
Acc. X X X X X X X X X
Current Acc. value
Previous Acc. valueX X X X X X X XX X X X X X XX X X X X X X
Level 1
X X X X X X X X Level 2
X X X X X X X X Level 3
X X X X X X X X Level 4
X X X X X X X X Level 5
X X X X X X X X Level 6
X X X X X X X X Level 7
X X X X X X X X Level 8
Accumulator Stack
0 0 0 0 3 2 4 5 Level 1
X X X X X X X X Level 2
X X X X X X X X Level 3
X X X X X X X X Level 4
X X X X X X X X Level 5
X X X X X X X X Level 6
X X X X X X X X Level 7
X X X X X X X X Level 8
Accumulator Stack
Acc.
Constant 5 1 5 1
0 0 0 0 5 5 1 5 1
Acc. 0 0 0 0 3 2 4 5 3 2 4 5
Current Acc. value
Previous Acc. value
0 0 0 0 5 1 5 1
0 0 0 0
Level 1
0 0 0 0 3 2 4 5 Level 2
X X X X X X X X Level 3
X X X X X X X X Level 4
X X X X X X X X Level 5
X X X X X X X X Level 6
X X X X X X X X Level 7
X X X X X X X X Level 8
Accumulator Stack
Acc.
Constant 6 3 6 3
0 0 0 0 6 3 6 3 6 3 6 3
Acc. 0 0 0 0 5 5 1 5 1
Current Acc. value
Previous Acc. value
Bucket
Bucket
Bucket
3 2 4 5
0 0 0 0 3 2 4 5
DL205 User Manual, 5th Edition, Rev. B 5-55
Chapter 5: Standard RLL Instructions
Acc.
POP the 1st value on the stack into theaccumulator and move stack valuesup one location
POPX1
POP
POP
V2000 4 5 4 5
X X X X X X XX X X X
Acc. 0 0 0 0 4 54 5 4 5
Previous Acc. value
Current Acc. value
0 0 0 0 3 7 9 2Level 1
0 0 0 0 7 9 3 0Level 2
X X X X X X X X??
Level 3
X X X X X X X XLevel 4
X X X X X X X XLevel 5
X X X X X X X XLevel 6
X X X X X X X XLevel 7
X X X X X X X XLevel 8
Accumulator Stack
0 0 0 0 7 9 3 0Level 1
X X X X X X X XLevel 2
X X X X X X X XLevel 3
X X X X X X X XLevel 4
X X X X X X X XLevel 5
X X X X X X X XLevel 6
X X X X X X X XLevel 7
X X X X X X X XLevel 8
Accumulator Stack
X X X X X X X XLevel 1
X X X X X X X XLevel 2
X X X X X X X XLevel 3
X X X X X X X XLevel 4
X X X X X X X XLevel 5
X X X X X X X XLevel 6
X X X X X X X XLevel 7
X X X X X X X XLevel 8
Accumulator Stack
POP the 1st value on the stack into theaccumulator and move stack valuesup one location
POP the 1st value on the stack into theaccumulator and move stack valuesup one location
OUT
V2000
OUT
V2001
Acc.
V2001 3 7 9 2
0 0 0 0 4 5 4 54 5 4 5
Acc. 0 0 0 0 3 7 9 23 7 9 2
Previous Acc. value
Current Acc. value
Acc.
V2002 7 9 3 0
0 0 0 0 3 4 6 03 7 9 2
Acc. X X X X 7 9 3 0
Previous Acc. value
Current Acc. value
OUT
V2002
Copy data from the accumulator toV2000
Copy data from the accumulator toV2001.
Copy data from the accumulator toV2002
DL205 User Manual, 5th Edition, Rev. B5-56
Chapter 5: Standard RLL Instructions
Changing the Accumulator DataInstructions that manipulate data also use the accumulator. The result of the manipulated data resides in the accumulator. The data that was being manipulated is cleared from the accumulator. The following example loads the constant value 4935 into the accumulator, shifts the data right 4 bits, and outputs the result to V1410.
Some of the data manipulation instructions use 32 bits. They use two consecutive V-memory locations or an 8-digit BCD constant to manipulate data in the accumulator.
The following example rotates the value 67053101 two bits to the right and outputs the value to V1410 and V1411.
LD
K4935
X1
Load the value 4935 into theaccumulator
Shift the data in the accumulator4 bits (K4) to the right
Output the lower 16 bits of theaccumulator to V1410
0 1 0 0 1 0 0 1 0 0 1 1 0 1 0 1
Constant
V1410
0 0 0 0 0 1 0 0 1 0 0 1 0 0 1 10 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Shifted out ofaccumulator
0 4 9 3
4 9 3 5
SHFR
K4
OUT
V1410
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
The upper 16 bits of the accumulatorwill be set to 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
Acc.
LDD
K67053101
X1
Load the value 67053101into the accumulator
Rotate the data in theaccumulator 2 bits to the right
Output the value in theaccumulator to V1410 and V1411
0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 1
V1410
0 1 0 0 1 1 0 0 0 1 0 0 0 0 0 00 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
8 C 4 0
ROTR
K2
OUTD
V1410
0 1 0 1 1 0 0 1 1 1 0 0 0 0 0 1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
0 1 1 0 0 1 1 1 0 0 0 0 0 1 0 1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
Acc.
V1411
5 9 C 1
Constant 6 7 0 5 3 1 0 1
DL205 User Manual, 5th Edition, Rev. B 5-57
Chapter 5: Standard RLL Instructions
Using PointersMany of the DL205 series instructions will allow V-memory pointers as an operand. Pointers can be useful in ladder logic programming, but can be difficult to understand or implement in your application if you do not have prior experience with pointers (commonly known as indirect addressing). Pointers allow instructions to obtain data from V-memory locations referenced by the pointer value.
NOTE: In the DL205, V-memory addressing is in octal. However the value in the pointer location which will reference a V-memory location is viewed as HEX. Use the Load Address instruction to move an address into the pointer location. This instruction performs the Octal to Hexadecimal conversion for you.
The following example uses a pointer operand in a Load instruction. V-memory location 3000 is the pointer location. V3000 contains the value 400, which is the HEX equivalent of the Octal address V-memory location V2000. The CPU copies the data from V2000 into the lower word of the accumulator.
The following example is similar to the one above, except for the LDA (load address) instruction, which automatically converts the Octal address to the Hex equivalent.
V3000 (P3000) contains the value 400Hex. 400 Hex. = 2000 Octal whichcontains the value 2635.
LD
P3000
X1
OUT
V3100
Copy the data from the lower 16 bits ofthe accumulator to V3100.
V3000
0 4 0 0
2 6 3 5
X X X X
X X X X
X X X X
X X X X
X X X X
V3100 2 6 3 5
V3101 X X X X
2 6 3 5
Accumulator
V2000
V2001
V2002
V2003
V2004
V2005
V3000 (P3000) contains the value 400HEX = 2000 Octal which contains thevalue 2635
LDA
O 2000
X1
OUT
V 3000
Copy the data from the lower 16 bits ofthe accumulator to V3000
V3000
0 4 0 0
2 6 3 5
X X X X
X X X X
X X X X
X X X X
X X X X
V3100 2 6 3 5
V3101 X X X X
LD
P 3000
OUT
V 3100
Copy the data from the lower 16 bits ofthe accumulator to V3100
Load the lower 16 bits of theaccumulator with Hexadecimalequivalent to Octal 2000 (400))
V3000
Acc.
2 0 0 0
0 4 0 0
0 0 0 0 0 4 0 0
2000 Octal is converted to Hexadecimal400 and loaded into the accumulator
Accumulator
0 0 0 0 2 6 3 5
Unused accumulator bitsare set to zero
V2000
V2001
V2002
V2003
V2004
V2005
DL205 User Manual, 5th Edition, Rev. B5-58
Chapter 5: Standard RLL Instructions
Load (LD)The Load instruction is a 16-bit instruction that loads the value (Aaaa), which is either a V-memory location or a 4-digit constant, into the lower 16 bits of the accumulator. The upper 16 bits of the accumulator are set to 0.
NOTE: Two consecutive Load instructions will place the value of the first Load instruction onto the accumulator stack.
In the following example, when X1 is on, the value in V2000 will be loaded into the accumulator and output to V2010.
�����
230
240
250-1
260
262
LDA aaa
Discrete Bit Flags Description SP76 On when the value loaded into the accumulator by any instruction is zero.
LDV2000
X1
Load the value in V2000 intothe lower 16 bits of theaccumulator
OUTV2010
Copy the value in the lower16 bits of the accumulator toV2010
V2010
Acc.
V20008 9 3 5
8 9 3 5
0 0 0 0 8 9 3 58 9 3 5
DirectSOFT
The unused accumulatorbits are set to zero
1B
2C
0A
0A
0A ENT
Handheld Programmer Keystrokes
STR$ ENT
SHFT ANDSTL
3D
OUTGX SHFT AND
V2
C0
A1
B0
A ENT
Operand Data Type
RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
A aaa aaa aaa aaa bbbV-memory V All See Memory map All, see Memory map
Pointer P – All V-memory; see Memory map
Constant K 0-FFFF 0-FFFF
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-59
Chapter 5: Standard RLL Instructions
Load Double (LDD)The Load Double instruction is a 32-bit instruction that loads the value (Aaaa), which is either two consecutive V-memory locations or an 8-digit constant value, into the accumulator.
NOTE: Two consecutive Load instructions will place the value of the first load instruction onto the accumulator stack.
In the following example, when X1 is on, the 32-bit value in V2000 and V2001 will be loaded into the accumulator and output to V2010 and V2011.
LDDA aaa
Operand Data Type
RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
A aaa aaa aaa aaa bbbV-memory V All; see Memory mapPointer P – All V-memory; see Memory map
Constant K 0-FFFFFFFF 0-FFFFFFFF
1B ENT
2C
0A
0A
0A ENT
2C
0A
1B
0A ENT
Handheld Programmer Keystrokes
DirectSOFT
LDDV2000
X1
Load the value in V2000 andV2001 into the 32 bitaccumulator
OUTDV2010
Copy the value in the 32 bitaccumulator to V2010 andV2011
V2010
Acc.
V2000
6 7 3 9 6 0 2 6 5 0 2 6?
V2001
?6 7 3 9 5 0 2 6
V2011
6 7 3 9 5 0 2 6
STR$
SHFT ANDSTL
3D
3D
OUTGX SHFT 3
D
�����
230
240
250-1
260
262
Discrete Bit Flags Description SP76 On when the value loaded into the accumulator by any instruction is zero.
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B5-60
Chapter 5: Standard RLL Instructions
Load Formatted (LDF)The Load Formatted instruction loads 1 to 32 consecutive bits from discrete memory locations into the accumulator. The instruction requires a starting location (Aaaa) and the number of bits (Kbbb) to be loaded. Unused accumulator bit locations are set to zero.
NOTE: Two consecutive Load instructions will place the value of the first Load instruction onto the accumulator stack.
In the following example, when C0 is on, the binary pattern of C10–C16 (7 bits) will be loaded into the accumulator using the Load Formatted instruction. The lower 7 bits of the accumulator are output to Y0–Y6 using the Out Formatted instruction.
bbbKLDF A aaa
0A
7H ENT
Handheld Programmer Keystrokes
LDF C10K7
C0
Load the status of 7consecutive bits (C10–C16)into the accumulator
OUTF Y0K7
Copy the value from thespecified number of bits inthe accumulator to Y0 – Y6
K7C10
Location Constant
0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
K7Y0
Location Constant
C16 C15 C14 C13 C12 C11 C10
OFFONONONOFFOFFOFF
? ? ? ? ? Y6 Y5 Y4 Y3 Y2 Y1 Y0 OFFONONONOFFOFFOFF
The unused accumulator bits are set to zero
DirectSOFT
STR$ SHFT ENT2
C0
A
SHFT ANDSTL
3D
5F
SHFT 2C
1B
0A
7H ENT
OUTGX SHFT 5
F
230
240
250-1
260
262
�����
Operand Data Type RangeD2-240 D2-250-1 D2-260/D2-262
A aaa bbb aaa bbb aaa bbbInputs X 0–477 – 0–777 – 0–1777 –Outputs Y 0–477 – 0–777 – 0–1777 –Control Relays C 0–377 – 0–1777 – 0–3777 –Stage bits S 0–777 – 0–1777 – 0–1777 –Timer bits T 0–177 – 0–377 – 0–377 –Counter bits CT 0–177 – 0–177 – 0–377 –Special Relays SP 0-137, 540-617 – 0–777 – 0–777 –Global I/O GX/GY – – – – 0–3777 –Constant K – 1–32 – 1–32 – 1–32
Discrete Bit Flags Description SP76 ON when the value loaded into the accumulator by any instruction is zero.
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-61
Chapter 5: Standard RLL Instructions
Load Address (LDA)The Load Address instruction is a 16-bit instruction. It converts any octal value or address to the HEX equivalent value and loads the HEX value into the accumulator. This instruction is useful when an address parameter is required since all addresses for the DL205 system are in octal.
NOTE: Two consecutive Load instructions will place the value of the first Load instruction onto the accumulator stack.
In the following example, when X1 is on, the octal number 40400 will be converted to a HEX 4100 and loaded into the accumulator using the Load Address instruction. The value in the lower 16 bits of the accumulator is copied to V2000 using the Out instruction.
O aaaLDA
�����
230
240
250-1
260
262
Discrete Bit Flags Description SP76 ON when the value loaded into the accumulator by any instruction is zero.
Operand Data Type
RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
aaa aaa aaa aaa
Octal Address O All V-memory; see Memory map
1B ENT
4E
0A
4E
0A
0A ENT
Handheld Programmer Keystrokes
DirectSOFT
LDAO 40400
X1
Load The HEX equivalent tothe octal number into thelower 16 bits of theaccumulator
OUTV2000
Copy the value in lower 16bits of the accumulator toV2000
V2000
Acc.
Hexadecimal4 1 0 0
4 1 0 0
0 0 0 0 4 1 0 0
Octal4 0 4 0 0
The unused accumulator bits are set to zero
STR$
SHFT ANDSTL
3D
0A
OUTGX SHFT AND
V2
C0
A0
A ENT0A
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B5-62
Chapter 5: Standard RLL Instructions
Load Accumulator Indexed (LDX)Load Accumulator Indexed is a 16-bit instruction that specifies a source address (V-memory) which will be offset by the value in the first stack location. This instruction interprets the value in the first stack location as HEX. The value in the offset address (source address + offset) is loaded into the lower 16 bits of the accumulator. The upper 16 bits of the accumulator are set to 0.
Helpful hint: — The Load Address instruction can be used to convert an octal address to a HEX address and load the value into the accumulator.
NOTE: Two consecutive Load instructions will place the value of the first load instruction onto the accumulator stack.
In the following example, when X1 is on, the HEX equivalent for octal 25 will be loaded into the accumulator (this value will be placed on the stack when the Load Accumulator Indexed instruction is executed). V-memory location V1410 will be added to the value in the first level of the stack and the value in this location (V1435 = 2345) is loaded into the lower 16 bits of the accumulator using the Load Accumulator Indexed instruction. The value in the lower 16 bits of the accumulator is output to V1500 using the Out instruction.
A aaaLDX
230
240
250-1
260
262
�����
Operand Data Type
RangeD2-250-1 D2-260/D2-262
A aaa aaa
V-memory V All. See memory map
All. See memory map
Pointer P All V-memory. See memory map
All V-memory. See memory map
Copy the value in the lower16 bits of the accumulatorto V1500
LDA
O 25
X1
LDX
V1410
OUT
V1500
Acc. 0 0 0 0 0 0 1 5
Hexadecimal
0 0 1 5
Octal
2 5
The unused accumulator bits are set to zero
V1500
Acc.
Octal
1 4 3 5
2 3 4 5
0 0 0 0 2 3 4 5
V
Octal
1 4 1 0
The unused accumulator bits are set to zero
+ 1 5
HEX Value in 1st stack location
0 0 0 0 0 0 1 5Level 1
X X X X X X X XLevel 2
X X X X X X X XLevel 3
X X X X X X X XLevel 4
X X X X X X X XLevel 5
X X X X X X X XLevel 6
X X X X X X X XLevel 7
X X X X X X X XLevel 8
Accumulator Stack
V=
Load The HEX equivalent tooctal 25 into the lower 16bits of the accumulator
Move the offset to the stack.Load the accumulator withthe address to be offset
The value in V1435is 2345
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-63
Chapter 5: Standard RLL Instructions
Load Accumulator Indexed from Data Constants (LDSX)The Load Accumulator Indexed from Data Constants is a 16-bit instruction. The instruction specifies a Data Label Area (DLBL) where numerical or ASCII constants are stored. This value will be loaded into the lower 16 bits.
The LDSX instruction uses the value in the first level of the accumulator stack as an offset to determine which numerical or ASCII constant within the Data Label Area will be loaded into the accumulator. The LDSX instruction interprets the value in the first level of the accumulator stack as a HEX value.
Helpful hint: — The Load Address instruction can be used to convert octal to HEX and load the value into the accumulator.
NOTE: Two consecutive Load instructions will place the value of the first load instruction onto the accumulator stack.
In the following example, when X1 is on, the offset of 1 is loaded into the accumulator. This value will be placed into the first level of the accumulator stack when the LDSX instruction is executed. The LDSX instruction specifies the Data Label (DLBL K2) where the numerical constant(s) are located in the program and loads the constant value, indicated by the offset in the stack, into the lower 16 bits of the accumulator.
LDSX
K aaa
LD
K1
X1
Load the offset value of 1 (K1) into the lower 16bits of the accumulator.
LDSX
K2
Move the offset to the stack.Load the accumulator with the data labelnumber
END
K2
NCON
K3333
NCON
K2323
NCON
K4549
Acc. 0 0 0 0 0 0 0 1
Hexadecimal
0 0 0 1
The unused accumulator bits are set to zero
Value in 1st. level of stack isused as offset. The value is 1
Offset 0
Offset 1
Offset 2
V2000
Acc.
2 3 2 3
0 0 0 0 2 3 2 3
0 0 0 0 0 0 0 1Level 1
X X X X X X X XLevel 2
X X X X X X X XLevel 3
X X X X X X X XLevel 4
X X X X X X X XLevel 5
X X X X X X X XLevel 6
X X X X X X X XLevel 7
X X X X X X X XLevel 8
Accumulator Stack
Acc. 0 0 0 0 0 0 0 2
K
Constant
0 0 0 2
The unused accumulator bits are set to zero
The unused accumulator bits are set to zero
Copy the value in the lower16 bits of the accumulatorto V2000
OUT
V2000
.
. .
DLBL
230
240
250-1
260
262
�����DS Used
HPP Used
Operand Data Type
RangeD2-240 D2-250-1 D2-260/D2-262
A aaa aaa aaaConstant K 1-FFFF
DL205 User Manual, 5th Edition, Rev. B5-64
Chapter 5: Standard RLL Instructions
Load Real Number (LDR)The Load Real Number instruction loads a real number contained in two consecutive V-memory locations, or an 8-digit constant into the accumulator.
DirectSOFT allows you to enter real numbers directly, by using the leading “R” to indicate a real number entry. You can enter a constant such as Pi, shown in the example to the right. To enter negative numbers, use a minus (–) after the “R”.
For very large numbers or very small numbers, you can use exponential notation. The number to the right is 5.3 million. The OUTD instruction stores it in V1400 and V1401.
These real numbers are in the IEEE 32-bit floating point format, so they occupy two V-memory locations, regardless of how big or small the number may be! If you view a stored real number in hex, binary, or even BCD, the number shown will be very difficult to decipher. Just like all other number types, you must keep track of real number locations in memory, so they can be read with the proper instructions later.
The previous example above stored a real number in V1400 and V1401. Suppose that now we want to retrieve that number. Just use the Load Real with the V data type, as shown to the right. Next we could perform real math on it, or convert it to a binary number.
1B ENT
ENT2
C
Handheld Programmer KeystrokesSTR
$
SHFTANDSTL
3D SHFT
JMPK
1B ENT
SHFTANDSTL
3D
RSTS
SETX
SHFT4
ETMR
N3
D ENT
SHFT3
DANDSTL
1B
ANDSTL
2C ENT
SHFTTMR
N2
CINST#O
TMRN
3D
3D
3D
3D ENT
SHFTTMR
N2
CINST#O
TMRN
3D
3D ENT
2C
2C
SHFTTMR
N2
CINST#O
TMRN ENT
4E
5F
4E
9J
OUTGX SHFT
ANDV
2C
0A
0A ENT
0A
A aaaLDR230
240
250-1
260
262
�����
R3.14159LDR
R5.3E6LDR
V1400OUTD
V1400LDR
Operand Data Type
RangeD2-250-1 D2-260/D2-262
A aaa aaaV-memory V All. See memory map All. See memory mapPointer P All V-memory. See memory map All V-memory. See memory map
Real Constants R -3.402823E+038 to +3.402823E+038
-3.402823E+038 to +3.402823E+038
DS UsedHPP N/A
DL205 User Manual, 5th Edition, Rev. B 5-65
Chapter 5: Standard RLL Instructions
Out (OUT)The Out instruction is a 16-bit instruction that copies the value in the lower 16 bits of the accumulator to a specified V-memory location (Aaaa).
In the following example, when X1 is on, the value in V2000 will be loaded into the lower 16 bits of the accumulator using the Load instruction. The value in the lower 16 bits of the accumulator are copied to V2010 using the Out instruction.
OUTA aaa�
����
230
240
250-1
260
262
DS UsedHPP Used
2C
0A
0A
0A ENT
1B ENT
Handheld Programmer Keystrokes
STR$
SHFT ANDSTL
3D
OUTGX SHFT AND
V2
C0
A1
B0
A ENT
LDV2000
X1
Load the value in V2000 intothe lower 16 bits of theaccumulator
OUTV2010
Copy the value in the lower16 bits of the accumulator toV2010 V2010
Acc.
V20008 9 3 5
8 9 3 5
0 0 0 0 8 9 3 58 9 3 5
DirectSOFT
The unused accumulator bits are set to zero
Operand Data Type
RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
A aaa aaa aaa aaaV-memory V All; see Memory mapPointer P – All V-memory; see Memory map
Discrete Bit Flags Description SP76 ON when the value loaded into the accumulator by any instruction is zero.
DL205 User Manual, 5th Edition, Rev. B5-66
Chapter 5: Standard RLL Instructions
Out Double (OUTD)The Out Double instruction is a 32-bit instruction that copies the value in the accumulator to two consecutive V-memory locations at a specified starting location (Aaaa).
In the following example, when X1 is on, the 32-bit value in V2000 and V2001 will be loaded into the accumulator using the Load Double instruction. The value in the accumulator is output to V2010 and V2011 using the Out Double instruction.
2C
0A
0A
0A ENT
2C
0A
1B
0A ENT
1B ENT
Handheld Programmer Keystrokes
V2010
Acc.
V2000
6 7 3 9 5 0 2 6 5 0 2 6?
V2001
?6 7 3 9 5 0 2 6
V20116 7 3 9 5 0 2 6
Load the value in V2000 andV2001 into the accumulator
LDD
OUTD
Copy the value in theaccumulator to V2010 andV2011
V2000
X1
V2010
DirectSOFT
STR$
SHFT ANDSTL
3D
3D
OUTGX SHFT 3
D
OUTDA aaa
DS UsedHPP Used
�����
230
240
250-1
260
262 Operand Data Type
RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
A aaa aaa aaa aaaV-memory V All; see Memory mapPointer P – All V-memory; see Memory map
DL205 User Manual, 5th Edition, Rev. B 5-67
Chapter 5: Standard RLL Instructions
Out Formatted (OUTF)The Out Formatted instruction outputs 1 to 32 bits from the accumulator to the specified discrete memory locations. The instruction requires a starting location (Aaaa) for the destination and the number of bits (Kbbb) to be output.
In the following example, when C0 is on, the binary pattern of C10–C16 (7 bits) will be loaded into the accumulator using the Load Formatted instruction. The lower 7 bits of the accumulator are output to Y20–Y26 using the Out Formatted instruction.
bbbKOUTF A aaa
Operand Data Type RangeD2-240 D2-250-1 D2-260/D2-262
A aaa bbb aaa bbb aaa bbbConstant K 1-32 1-32 1-32
230
240
250-1
260
262
�����
0A
7H ENT
Handheld Programmer Keystrokes
LDF C10K7
C0
Load the status of 7consecutive bits (C10–C16)into the accumulator
OUTF Y20K7
Copy the value of thespecified number of bitsfrom the accumulator toY20–Y26
K7C10
Location Constant
0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
K7Y20
Location Constant
C16 C15 C14 C13 C12 C11 C10 OFFONONONOFFOFF OFF
Y21 Y20Y23 Y22Y26 Y25 Y24
OFFONONONOFFOFFOFF
The unused accumulator bits are set to zero
Accumulator
DirectSOFT
STR$ SHFT ENT2
C0
A
SHFT ANDSTL
3D
5F
SHFT 2C
1B
0A
7H ENT
OUTGX SHFT 5
F
2C
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B5-68
Chapter 5: Standard RLL Instructions
Out Indexed (OUTX)The Out Indexed instruction is a 16-bit instruction. It copies a 16-bit or 4-digit value from the first level of the accumulator stack to a source address offset by the value in the accumulator (V-memory + offset). This instruction interprets the offset value as a HEX number. The upper 16 bits of the accumulator are set to zero.
In the following example, when X1 is on, the constant value 3544 is loaded into the accumulator. This is the value that will be output to the specified offset V-memory location (V1525). The value 3544 will be placed onto the stack when the Load Address instruction is executed. Remember, two consecutive Load instructions places the value of the first load instruction onto the stack. The Load Address instruction converts octal 25 to HEX 15 and places the value in the accumulator. The Out Indexed instruction outputs the value 3544, which resides in the first level of the accumulator stack to V1525.
aaaA
O UT X
2 5
X1
OUTX
0 0 0 0 3 5 4 4
Constant3 5 4 4
Acc.
3 5 4 4
0 0 0 0 0 0 1 5
The unused accumulatorbits are set to zero.
0 0 0 0 3 5 4 4Level 1
X X X X X X X XLevel 2
X X X X X X X XLevel 3
X X X X X X X XLevel 4
X X X X X X X XLevel 5
X X X X X X X XLevel 6
X X X X X X X XLevel 7
X X X X X X X XLevel 8
0 0 1 52 5
V 1 5 2 51 5 0 0V + =
The unused accumulatorbits are set to zero.
Acc.
Octal HEX
Octal Octal Octal
The hex 15 converts to 25 octal, which is added to the baseaddress of V1500 to yieldthe final destination.
V1525
LD
LDA
K3544
O25
V1500
Load the accumulator withthe value 3544.
Load the HEX equivalent tooctal 25 into the lower 16 bits of the accumulator. This is theoffset for the Out Indexedinstruction, which determines the final destinaltion address.
Copy the value in the firstlevel of the stack to theoffset address V1525(V1500+25).
Accumulator Stack
Handheld Programmer Keystrokes
STR$
SHFT ANDSTL
3D
SHFT
1B ENT
ENT
2C
0A
ENT
1B
5F
0A
0A
PREV
ANDSTL
3D ENT5
F
3D
5F
4E
4E
OUTGX SHFT SET
X
DirectSOFT
230
240
250-1
260
262
�����
Operand Data Type
RangeD2-250-1 Range D2-260/D2-262
A aaa aaa
V-memory V All. See memory map
All. See memory map
Pointer P All V-memory. See memory map
All V-memory. See memory map
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-69
Chapter 5: Standard RLL Instructions
Out Least (OUTL)The Out Least instruction copies the value in the lower eight bits of the accumulator to the lower eight bits of the specified V-memory location (i.e., it copies the low byte of the low word of the accumulator).
In the following example, when X1 is on, the value in V1400 will be loaded into the lower 16 bits of the accumulator using the Load instruction. The value in the lower 8 bits of the accumulator are copied to V1500 using the Out Least instruction.
Out Most (OUTM)The Out Most instruction copies the value in the upper eight bits of the lower 16 bits of the accumulator to the upper eight bits of the specified V-memory location (i.e., it copies the high byte of the low word of the accumulator).
In the following example, when X1 is on, the value in V1400 will be loaded into the lower 16 bits of the accumulator using the Load instruction. The value in the upper 8 bits of the lower 16 bits of the accumulator are copied to V1500 using the Out Most instruction.
A aaaO UT L
A aaaO UT M
A aaaO UT M
LD
Acc.
8 9 3 5
0 0 3 5
0 0 0 0 8 9 3 5
X1
V1400
OUTL
V1500
Load the value in V1400 intothe lower 16 bits of theaccumulater
Copy the value in the lower8 bits of the accumulator toV1500
The unused accumulatorbits are set to zero
V1400
V1500
Handheld Programmer Keystrokes
1B ENT
1B
4E
0A
0A ENT
STR$
SHFT ANDSTL
3D
OUTGX SHFT ANDST
L1
B5
F0
A0
A ENT
LD
Acc.
8 9 3 5
8 9 0 0
0 0 0 0 8 9 3 5
Handheld Programmer Keystrokes
1B ENT
1B
4E
0A
0A ENT
STR$
SHFT ANDSTL
3D
OUTGX SHFT ORST
M1
B5
F0
A0
A ENT
X1
V1400
OUTM
V1500
Load the value in V1400 intothe lower 16 bits of theaccumulator
Copy the value in the upper8 bits of the lower 16 bits ofthe accumulator to V1500
The unused accumulatorbits are set to zero
V1400
V1500
�����
230
240
250-1
260
262
�����
230
240
250-1
260
262
Operand Data Type D2-260/D2-262 Range A aaaV-memory V All V-memory. See memory mapPointer P All V-memory. See memory map
Operand Data Type D2-260/D2-262 Range A aaaV-memory V All V-memory. See memory mapPointer P All V-memory. See memory map
DS UsedHPP Used
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B5-70
Chapter 5: Standard RLL Instructions
Pop (POP)The Pop instruction moves the value from the first level of the accumulator stack (32 bits) to the accumulator and shifts each value in the stack up one level. In the example below, when C0 is on, the value 4545 that was on top of the stack is moved into the accumulator using the Pop instruction. The value is output to V2000 using the Out instruction. The next Pop moves the value 3792 into the accumulator and outputs the value to V2001. The last Pop moves the value 7930 into the accumulator and outputs the value to V2002. Please note if the value in the stack were greater than 16 bits (4 digits) the Out Double instruction would be used and two V-memory locations for each Out Double must be allocated.
POP
Handheld Programmer Keystrokes
Acc.
Pop the 1st. value on the stack into theaccumulator and move stack valuesup one location
POPC0
POP
POP
V2000 4 5 4 5
X X X X X X X XX X X X
Acc. 0 0 0 0 4 5 4 54 5 4 5
Previous Acc. value
Current Acc. value
0 0 0 0 3 7 9 20 0
Level 1
0 0 0 0 7 9 3 0Level 2
X X X X X X X XLevel 3
X X X X X X X XLevel 4
X X X X X X X XLevel 5
X X X X X X X XLevel 6
X X X X X X X XLevel 7
X X X X X X X XLevel 8
Accumulator Stack
0 0 0 0 7 9 3 0Level 1
X X X X X X X XLevel 2
X X X X X X X XLevel 3
X X X X X X X XLevel 4
X X X X X X X XLevel 5
X X X X X X X XLevel 6
X X X X X X X XLevel 7
X X X X X X X XLevel 8
Accumulator Stack
X X X X X X X XLevel 1
X X X X X X X XLevel 2
X X X X X X X XLevel 3
X X X X X X X XLevel 4
X X X X X X X XLevel 5
X X X X X X X XLevel 6
X X X X X X X XLevel 7
X X X X X X X XLevel 8
Accumulator Stack
Pop the 1st. value on the stack into theaccumulator and move stack valuesup one location
Pop the 1st. value on the stack into theaccumulator and move stack valuesup one location
OUTV2000
OUTV2001
Acc.
V2001 3 7 9 2
0 0 0 0 4 5 4 54 5 4 5
Acc. 0 0 0 0 3 7 9 2
Previous Acc. value
Current Acc. value
Acc.
V2002 7 9 3 0
0 0 0 0 3 7 9 2
Acc. 0 0 0 0 7 9 3 0
Previous Acc. value
Current Acc. value
OUTV2002
Copy the value in the lower 16 bits ofthe accumulator to V2000
Copy the value in the lower 16 bits ofthe accumulator to V2001
Copy the value in the lower 16 bits ofthe accumulator to V2002
DirectSOFT
STR$ SHFT 2
C0
A ENT
SHFT CVP
INST#O
CVP ENT
OUTGX SHFT AND
V2
C0
A0
A ENT0A
SHFT CVP
INST#O
CVP ENT
OUTGX SHFT AND
V2
C0
A ENT0A
1B
SHFT CVP
INST#O
CVP ENT
OUTGX SHFT AND
V2
C0
A ENT0A
2C
SHFT
SHFT
SHFT
Discrete Bit Flags DescriptionSP63 On when the result of the instruction causes the value in the accumulator to be zero.
DS UsedHPP Used
�����
230
240
250-1
260
262
DL205 User Manual, 5th Edition, Rev. B 5-71
Chapter 5: Standard RLL Instructions
Logical Instructions (Accumulator)And (AND)
The And instruction is a 16-bit instruction that logically ANDs the value in the lower 16 bits of the accumulator with a specified V-memory location (Aaaa). The result resides in the accumulator. The discrete status flag indicates if the result of the And is zero.
NOTE: The status flags are only valid until another instruction that uses the same flags is executed.
In the following example, when X1 is on, the value in V2000 will be loaded into the accumulator using the Load instruction. The value in the accumulator is anded with the value in V2006 using the And instruction. The value in the lower 16 bits of the accumulator is output to V2010 using the Out instruction.
Discrete Bit Flags DescriptionSP63 On when the result of the instruction causes the value in the accumulator to be zero.
ANDA aaa
AND (V2006)
Handheld Programmer Keystrokes
LDV2000
X1
Load the value in V2000 intothe lower 16 bits of theaccumulator
ANDV2006
AND the value in theaccumulator with the value in V2006
OUTV2010
Copy the lower 16 bits of theaccumulator to V2010
0 0 1 0 1 0 0 0 0 1 1 1 1 0 1 0
0 0 1 0 1 0 0 0 0 0 1 1 1 0 0 00 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
V20002 8 7 A?
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
The upper 16 bits of the accumulatorwill be set to 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
Acc.
0 0 1 0 1 0 0 0 0 1 1 1 1 0 1 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0Acc.
0 1 1 0 1 0 1 0 0 0 1 1 1 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 06A38
V2010
2 8 3 8
DirectSOFT
STR$
SHFT ANDSTL
3D
SHFT ANDV
2C
0A
0A ENT6
G
OUTGX SHFT AND
V2
C0
A1
B0
A ENT
ANDV
1B ENT
2C
0A
0A
0A ENT
DS UsedHPP Used
�����
230
240
250-1
260
262Operand Data
Type Range
D2-230 D2-240 D2-250-1 D2-260/D2-262 A aaa aaa aaa aaaV-memory V All; see Memory mapPointer P – All V-memory; see Memory map
DL205 User Manual, 5th Edition, Rev. B5-72
Chapter 5: Standard RLL Instructions
And Double (ANDD)The And Double is a 32-bit instruction that logically ANDs the value in the accumulator with two consecutive V-memory locations or an 8-digit (max) constant value (Aaaa). The result resides in the accumulator. Discrete status flags indicate if the result of the And Double is zero or a negative number (the most significant bit is on).
NOTE: The status flags are only valid until another instruction that uses the same flags is executed.
In the following example, when X1 is on, the value in V2000 and V2001 will be loaded into the accumulator using the Load Double instruction. The value in the accumulator is anded with 36476A38 using the And Double instruction. The value in the accumulator is output to V2010 and V2011 using the Out Double instruction.
A aaaANDD
AND 36476A38
Handheld Programmer Keystrokes
LDDV2000
X1
Load the value in V2000 andV2001 into the accumulator
ANDDK36476A38
AND the value in theaccumulator with the constant value36476A38
OUTDV2010
Copy the value in theaccumulator to V2010 andV2011
0 0 1 0 1 0 0 0 0 1 1 1 1 0 1 0
0 0 1 0 1 0 0 0 0 0 1 1 1 0 0 00 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
2 8 7 A
0 0 0 1 0 1 0 0 0 1 0 0 0 1 1 0
0 1 0 1 0 1 0 0 0 1 1 1 1 1 1 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
Acc.
Acc.
V2010
2 8 3 8
5 4 7 E
V2011
1 4 4 6
0 1 0 1 0 1 0 0 0 1 1 1 1 1 1 0 0 0 1 0 1 0 0 0 0 1 1 1 1 0 1 0
0 1 1 0 1 0 1 0 0 0 1 1 1 0 0 00 0 1 1 0 1 1 0 0 1 0 0 0 1 1 1
DirectSOFT
STR$
SHFT ANDSTL
3D
SHFT
OUTGX
3D
SHFT 3D
ANDV SHFT 3
D8
I3
DSHFTSHFTJMPK
0A
3D
6G
4E
7H
6G ENT
1B ENT
2C
0A
1B
0A ENT
2C
0A
0A ENT0
A
V2000 V2000
Operand Data Type RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
A aaa aaa aaa aaaV-memory V - - All. See memory map
Pointer P - - All V-memory. See memory map
Constant K 0-FFFFFFFF 0-FFFFFFFF 0-FFFFFFFF 0-FFFFFFFF
Discrete Bit Flags DescriptionSP63 Will be on if the result in the accumulator is zeroSP70 Will be on if the result in the accumulator is negative
DS UsedHPP Used
�����
230
240
250-1
260
262
DL205 User Manual, 5th Edition, Rev. B 5-73
Chapter 5: Standard RLL Instructions
And Formatted (ANDF)The And Formatted instruction logically ANDs the binary value in the accumulator and a specified range of discrete memory bits (1 to 32). The instruction requires a starting location (Aaaa) and number of bits (Kbbb) to be ANDed. Discrete status flags indicate if the result is zero or a negative number (the most significant bit =1).
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example, when X1 is on, the Load Formatted instruction loads C10–C13 (4 binary bits) into the accumulator. The accumulator content is logically ANDed with the bit pattern from Y20–Y23 using the And Formatted instruction. The Out Formatted instruction outputs the accumulator’s lower four bits to C20–C23.
Discrete Bit Flags DescriptionSP63 Will be on if the result in the accumulator is zeroSP70 Will be on if the result in the accumulator is negative
bbbKANDF A aaa
ndar
dR
LL
C10K4
X1
K4
K4C10
0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
C10C11C12C13
Y20Y21Y22Y23
Accumulator
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0Acc.
Acc. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0
1 0 0 0
C20C21C22C23
DirectSOFT
Load the status of 4consecutive bits (C10-C13)into the accumulator
ANDF Y20K4
And the binary bit pattern (Y20-Y23) with the value inthe accumulator
OUTF C20
Copy the value in the lower 4 bits in accumulator toC20-C23
AND (Y20-Y23)
The unused accumulator bits are set to zero
Location Constant
ConstantLocation
ON ON ON OFF
ON OFFOFFOFF
ON OFFOFFOFFC20 K4
LDF
Handheld Programmer Keystrokes
1B ENT
1B
4E
0A
0A
ENT
STR$
SHFT ANDSTL
3D
OUTGX SHFT 5
F
5F
ANDV SHFT 5
F
NEXT NEXT NEXT NEXT
NEXT 2C
4E ENT
PREV PREV 0A
2C
4E ENT
Operand Data Type D2-250-1 Range D2-260/D2-262 Range A aaa bbb aaa bbbInputs X 0–777 – 0–1777 –Outputs Y 0–777 – 0–1777 –Control Relays C 0–1777 – 0–3777 –Stage bits S 0–1777 – 0–1777 –Timer bits T 0–377 – 0–377 –Counter bits CT 0–177 – 0–377 –Special Relays SP 0-777 – 0–777 –Global I/O GX/GY - – 0-3777 –Constant K - 1–32 - 1–32
230
240
250-1
260
262
�����DS Used
HPP Used
DL205 User Manual, 5th Edition, Rev. B5-74
Chapter 5: Standard RLL Instructions
And with Stack (ANDS)The And with Stack instruction is a 32-bit instruction that logically ANDs the value in the accumulator with the first level of the accumulator stack. The result resides in the accumulator. The value in the first level of the accumulator stack is removed from the stack and all values are moved up one level. Discrete status flags indicate if the result of the And with Stack is zero or a negative number (the most significant bit is on).
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example, when X1 is on, the binary value in the accumulator will be anded with the binary value in the first level of the accumulator stack. The result resides in the accumulator. The 32-bit value is then output to V1500 and V1501.
ANDS�����
230
240
250-1
260
262
AND
X1
0 0 1 0 1 0 0 0 0 1 1 1 1 0 1 0
0 0 1 0 1 0 0 0 0 0 1 1 1 0 000 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
V14002 8 7 A
0 0 0 1 0 1 0 0 0 1 0 0 0 1 1 0
0 1 0 1 0 1 0 0 0 1 1 1 1 1 1 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
Acc.
Acc.
V1500
2 8 3 8
5 4 7 E
1 4 4 6
0 1 0 1 0 1 0 0 0 1 1 1 1 1 1 0 0 0 1 0 1 0 0 0 0 1 1 1 1 0 1 0
0 1 1 0 1 0 1 0 0 0 1 1 1 0 0 00 0 1 1 0 1 1 0 0 1 0 0 0 1 1 1
LDD
V1400
Load the value in V1400 and1401 into the accumulator
ANDS
AND the value in theaccumulator with the first level of the accumulator stack
OUTD
V1500
(top of stack)36476A38
V1501
V1401
Copy the value in theaccumulator to V1500and 1501
Handheld Programmer Keystrokes
1B ENT
1B
4E
0A
0A ENT
STR$
SHFT ANDSTL
3D
OUTGX SHFT 3
D1
B5
F0
A0
A ENT
3D
ANDV SHFT RST
S ENT
DirectSOFT
DS UsedHPP Used Discrete Bit Flags Description
SP63 Will be on if the result in the accumulator is zeroSP70 Will be on if the result in the accumulator is negative
DL205 User Manual, 5th Edition, Rev. B 5-75
Chapter 5: Standard RLL Instructions
Or (OR)The Or instruction is a 16-bit instruction that logically ORs the value in the lower 16 bits of the accumulator with a specified V-memory location (Aaaa). The result resides in the accumulator. The discrete status flag indicates if the result of the OR is zero.
NOTE: The status flags are only valid until another instruction that uses the same flags is executed.
In the following example, when X1 is on, the value in V2000 will be loaded into the accumulator using the Load instruction. The value in the accumulator is OR’d with V2006 using the OR instruction. The value in the lower 16 bits of the accumulator are output to V2010 using the Out instruction.
ORA aaa
3D
OR (V2006)
Handheld Programmer Keystrokes
LDV2000
X1
Load the value in V2000 intothe lower 16 bits of theaccumulator
ORV2006
Or the value in theaccumulator with the value in V2006
OUTV2010
Copy the value in the lower16 bits of the accumulator toV2010
0 0 1 0 1 0 0 0 0 1 1 1 1 0 1 0
0 1 1 0 1 0 1 0 0 1 1 1 1 0 1 00 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
V20002 8 7 A
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
The upper 16 bits of the accumulatorwill be set to 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 131 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
Acc.
0 0 1 0 1 0 0 0 0 1 1 1 1 0 1 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0Acc.
0 1 1 0 1 0 1 0 0 0 1 1 1 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 06A38
V2010
6 A 7 A
DirectSOFT
STR$
1B ENT
SHFT ANDSTL
2C
0A
0A
0A ENT
SHFT ANDV
2C
0A
0A ENT6
G
OUTGX SHFT AND
V2
C0
A1
B0
A ENT
ORQ
0
DS UsedHPP Used
�����
230
240
250-1
260
262
Operand Data Type
RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
A aaa aaa aaa aaaV-memory V All; see Memory mapPointer P – All V-memory; see Memory map
Discrete Bit Flags DescriptionSP63 Will be ON if the result in the accumulator is zero.
DL205 User Manual, 5th Edition, Rev. B5-76
Chapter 5: Standard RLL Instructions
Or Double (ORD)The Or Double is a 32-bit instruction that ORs the value in the accumulator with the value (Aaaa) or an 8-digit (max) constant value. The result resides in the accumulator. Discrete status flags indicate if the result of the Or Double is zero or a negative number (the most significant bit is on).
NOTE: The status flags are only valid until another instruction that uses the same flags is executed.
In the following example, when X1 is on, the value in V2000 and V2001 will be loaded into the accumulator using the Load Double instruction. The value in the accumulator is OR’d with 36476A38 using the Or Double instruction. The value in the accumulator is output to V2010 and V2011 using the Out Double instruction.
A aaaORD
JMPK
OR 36476A38
Handheld Programmer Keystrokes
LDDV2000
X1
Load the value in V2000 andV2001 into accumulator
ORDK36476A38
OR the value in theaccumulator with the constant value36476A38
OUTDV2010
Copy the value in theaccumulator to V2010 andV2011
0 0 1 0 1 0 0 0 0 1 1 1 1 0 1 0
0 1 1 0 1 0 1 0 0 1 1 1 1 0 1 00 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
2 8 7 A
0 1 1 1 0 1 1 0 0 1 1 1 1 1 1 1
0 1 0 1 0 1 0 0 0 1 1 1 1 1 1 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
Acc.
Acc.
V2010
6 A 7 A
5 4 7 E
V2011
7 6 7 F
0 1 0 1 0 1 0 0 0 1 1 1 1 1 1 0 0 0 1 0 1 0 0 0 0 1 1 1 1 0 1 0
DirectSOFT
0 1 1 0 1 0 1 0 0 0 1 1 1 0 0 00 0 1 1 0 1 1 0 0 1 0 0 0 1 1 1
STR$
SHFT ANDSTL
3D
SHFT
OUTGX
3D
SHFT 3D
SHFT 3D
ORQ
8I
3DSHFTSHFT 0
A3
D6
G4
E7
H6
G ENT
1B ENT
2C
0A
0A
0A ENT
2C
0A
1B
0A ENT
V2000V2001
DS UsedHPP Used
�����
230
240
250-1
260
262Operand Data
Type Range
D2-230 D2-240 D2-250-1 D2-260/D2-262 A aaa aaa aaa aaaV-memory V – – All; see Memory mapPointer P – – All V-memory; see Memory map
Constant K 0-FFFFFFFF
Discrete Bit Flags DescriptionSP63 Will be on if the result in the accumulator is zeroSP70 Will be on if the result in the accumulator is negative
DL205 User Manual, 5th Edition, Rev. B 5-77
Chapter 5: Standard RLL Instructions
Or Formatted (ORF)The Or Formatted instruction logically ORs the binary value in the accumulator and a specified range of discrete bits (1 to 32). The instruction requires a starting location (Aaaa) and the number of bits (Kbbb) to be ORed. Discrete status flags indicate if the result is zero or negative (the most significant bit =1).
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example, when X1 is on the Load Formatted instruction loads C10–C13 (4 binary bits) into the accumulator. The Or Formatted instruction logically ORs the accumulator contents with Y20–Y23 bit pattern. The Out Formatted instruction outputs the accumulator’s lower four bits to C20–C23.
bbbKORF A aaa
X1 K4C10
0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
Y20Y21Y22Y23
The unused accumulator bits are set to zero
OR (Y20--Y23)
0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0
1 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0Acc.
Constant
C20 K4 ON ON ON
OFF
OFF
OFFON ONC13 C12 C11 C10
C23 C22 C21 C20
ON OFF OFF OFF
Location Constant
Location
LDF C10
K4
ORF Y20
K4
OUTF C20
K4
Load the status of 4consecutive bits (C10-C13)into the accumulator
OR the binary bit pattern(Y20 - Y23) with the value inthe accumulator
Copy the specified numberof bits from the accumulatorto C20-C23
Handheld Programmer Keystrokes
1B ENT
1B
4E
0A
0A
ENT
STR$
SHFT ANDSTL
3D
OUTGX SHFT 5
F
5F
ORQ SHFT 5
F
NEXT NEXT NEXT NEXT
NEXT 2C
4E ENT
PREV PREV 0A
2C
4E ENT
DirectSOFT
230
240
250-1
260
262
�����
DS UsedHPP Used
Discrete Bit Flags DescriptionSP63 Will be on if the result in the accumulator is zeroSP70 Will be on if the result in the accumulator is negative
Operand Data Type D2-250-1 Range D2-260/D2-262 Range A aaa bbb aaa bbbInputs X 0–777 – 0–1777 –Outputs Y 0–777 – 0–1777 –Control Relays C 0–1777 – 0–3777 –Stage bits S 0–1777 – 0–1777 –Timer bits T 0–377 – 0–377 –Counter bits CT 0–177 – 0–377 –Special Relays SP 0-777 – 0–777 –Global I/O GX/GY - – 0-3777 –Constant K - 1–32 - 1–32
DL205 User Manual, 5th Edition, Rev. B5-78
Chapter 5: Standard RLL Instructions
Or with Stack (ORS)The Or with Stack instruction is a 32-bit instruction that logically ORs the value in the accumulator with the first level of the accumulator stack. The result resides in the accumulator. The value in the first level of the accumulator stack is removed from the stack and all values are moved up one level. Discrete status flags indicate if the result of the Or with Stack is zero or a negative number (the most significant bit is on).
In the following example, when X1 is on, the binary value in the accumulator will be ORed with the binary value in the first level of the stack. The result resides in the accumulator.
LDDV1400
0 0 1 0 1 0 0 0 0 1 1 1 1 0 1 0
0 1 1 0 1 0 1 0 0 1 1 1 1 0 1 00 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
V14002 8 7 A
0 1 1 1 0 1 1 0 0 1 1 1 1 1 1 1
0 1 0 1 0 1 0 0 0 1 1 1 1 1 1 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
Acc.
Acc.
V1500
6 A 7 A
V14015 4 7 E
V1501
7 6 7 F
0 1 0 1 0 1 0 0 0 1 1 1 1 1 1 0 0 0 1 0 1 0 0 0 0 1 1 1 1 0 1 0
0 1 1 0 1 0 1 0 0 0 1 1 1 0 0 00 0 1 1 0 1 1 0 0 1 0 0 0 1 1 1
DirectSOFT
X1
Load the value in V1400 andV1401 in the accumulator
ORS
OR the value in the accumulator with the value in the first level of theaccumulator stack
OUTD
V1500
36476A38OR (top of stack)
Copy the value in theaccumulator to V1500 andV1501
Handheld Programmer Keystrokes
1B ENT
1B
4E
0A
0A ENT
STR$
SHFT ANDSTL
3D
OUTGX SHFT 3
D1
B5
F0
A0
A ENT
3D
ORQ SHFT RST
S ENT
O R S�����
230
240
250-1
260
262
DS UsedHPP Used
Discrete Bit Flags DescriptionSP63 Will be on if the result in the accumulator is zeroSP70 Will be on if the result in the accumulator is negative
DL205 User Manual, 5th Edition, Rev. B 5-79
Chapter 5: Standard RLL Instructions
Exclusive Or (XOR)The Exclusive Or instruction is a 16-bit instruction that performs an exclusive OR of the value in the lower 16 bits of the accumulator and a specified V-memory location (Aaaa). The result resides in the accumulator. The discrete status flag indicates if the result of the XOR is zero.
NOTE: The status flags are only valid until another instruction that uses the same flags is executed.
In the following example, when X1 is on, the value in V2000 will be loaded into the accumulator using the Load instruction. The value in the accumulator is exclusive OR’d with V2006 using the Exclusive Or instruction. The value in the lower 16 bits of the accumulator are output to V2010 using the Out instruction.
XORA aaa
XOR (V2006)
Handheld Programmer Keystrokes
LDV2000
X1
Load the value in V2000 intothe lower 16 bits of theaccumulator
XORV2006
XOR the value in theaccumulator with the value in V2006
OUTV2010
Copy the lower 16 bits of theaccumulator to V2010
0 0 1 0 10 0 0 0 1 1 1 1 0 1 0
0 1 0 0 1 1 1 0 0 1 0 0 0 0 1 00 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
V20002 8 7 A
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
The upper 16 bits of the accumulatorwill be set to 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
Acc.
0 0 1 0 0 1 0 0 0 1 1 1 1 0 1 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0Acc.
6A38
V2010
4 E 4 2
DirectSOFT
0 1 1 0 1 0 1 0 0 0 1 1 1 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
STR$
1B ENT
SHFT ANDSTL
3D SHFT AND
V2
C0
A0
A0
A ENT
SHFT ANDV
2C
0A
0A ENT6
G
OUTGX SHFT AND
V2
C0
A1
B0
A ENT
ORQSHFT SHFTSET
X
DS UsedHPP Used
�����
230
240
250-1
260
262
Discrete Bit Flags DescriptionSP63 Will be on if the result in the accumulator is zeroSP70 Will be on if the result in the accumulator is negative
Operand Data Type
RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
A aaa aaa aaa aaaV-memory V All; see Memory mapPointer P – All V-memory; see Memory map
DL205 User Manual, 5th Edition, Rev. B5-80
Chapter 5: Standard RLL Instructions
Exclusive Or Double (XORD)The Exclusive Or Double is a 32-bit instruction that performs an exclusive OR of the value in the accumulator and the value (Kaaa), which is an 8-digit (max) constant. The result resides in the accumulator. Discrete status flags indicate if the result of the Exclusive Or Double is zero or a negative number (the most significant bit is on).
NOTE: The status flags are only valid until another instruction that uses the same flags is executed.
In the following example, when X1 is on, the value in V2000 and V2001 will be loaded into the accumulator using the Load Double instruction. The value in the accumulator is exclusively OR’d with 36476A38 using the Exclusive Or Double instruction. The value in the accumulator is output to V2010 and V2011 using the Out Double instruction.
K aaaXORD
JMPKSHFTSHFT 3
DOR
Q
XORD 36476A38
Handheld Programmer Keystrokes
LDD
V2000
X1
Load the value in V2000 andV2001 into the accumulator
XORDK36476A38
XORD the value in theaccumulator with the constant value36476A38
OUTDV2010
Copy the value in theaccumulator to V2010and V2011
0 0 1 0 1 0 0 0 0 1 1 1 1 0 1 0
0 1 0 0 0 0 1 0 0 1 0 0 0 0 1 00 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
V20002 8 7 A
0 1 1 0 0 0 1 0 0 0 1 1 1 0 0 1
0 1 0 1 0 1 0 0 0 1 1 1 1 1 1 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
Acc.
Acc.
V2010
4 2 4 2
V2001
?5 4 7 E
V2011
6 2 3 9
0 1 0 1 0 1 0 0 0 1 1 1 1 1 1 0 0 0 1 0 1 0 0 0 0 1 1 1 1 0 1 0
DirectSOFT
0 1 1 0 1 0 1 0 0 0 1 1 1 0 0 00 0 1 1 0 1 1 0 0 1 0 0 0 1 1 1
STR$
SHFT ANDSTL
3D
3D
SHFT SETX
OUTGX SHFT 3
D
3D
6G
4E
8I
3DSHFTSHFT 0
A7
H6
G ENT
1B ENT
2C
0A
0A
0A ENT
2C
0A
1B
0A ENT
Operand Data Type RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
aaa aaa aaa aaaConstant K 0-FFFFFFFF 0-FFFFFFFF 0-FFFFFFFF 0-FFFFFFFF
DS UsedHPP Used
�����
230
240
250-1
260
262
Discrete Bit Flags DescriptionSP63 Will be on if the result in the accumulator is zeroSP70 Will be on if the result in the accumulator is negative
DL205 User Manual, 5th Edition, Rev. B 5-81
Chapter 5: Standard RLL Instructions
Exclusive OR Formatted (XORF)The Exclusive Or Formatted instruction performs an exclusive OR of the binary value in the accumulator and a specified range of discrete memory bits (1 to 32).
The instruction requires a starting location (Aaaa) and the number of bits (Kbbb) to be exclusive OR’d. Discrete status flags indicate if the result of the Exclusive Or Formatted is zero or negative (the most significant bit is on).
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example, when X1 is on, the binary pattern of C10–C13 (4 bits) will be loaded into the accumulator using the Load Formatted instruction. The value in the accumulator will be logically Exclusive OR’d with the bit pattern from Y20–Y23 using the Exclusive Or Formatted instruction. The value in the lower 4 bits of the accumulator are output to C20–C23 using the Out Formatted instruction.
Sta
ndar
dR
LLK4C10
0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
C10C11C12C13
OFFONONOFF
Y20Y21Y22Y23
OFFONOFFON
Accumulator
0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0Acc.
Acc. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0
1 0 1 0
C20C21C22C23OFFOFFONONK4C20Handheld Programmer Keystrokes
1B ENT
1B
4E
0A
0A
ENT
STR$
SHFTANDSTL
3D
OUTGX SHFT
5F
5F
ORQSHFT
SETX SHFT
5F
NEXT NEXT NEXT NEXT
NEXT2
C4
E ENT
PREV PREV0
A2
C4
E ENT
Location Constant
Location Constant
The unused accumulator bits are set to zero
DirectSOFT32
X1LDF C10
K4
X0RF Y20
K4
OUTF C20
K4
Load the status of 4consecutive bits (C10-C13)into the accumulator
Exclusive OR the binary bit pattern (Y20-Y23) with thevalue in the accumulator
Copy the specified numberof bits from the accumulatorto C20-C23
XORF (Y20-Y23)
XORF A aaa
K bbb
230
240
250-1
260
262
�����DS Used
HPP Used
Discrete Bit Flags DescriptionSP63 Will be on if the result in the accumulator is zeroSP70 Will be on if the result in the accumulator is negative
Operand Data Type D2-250-1 Range D2-260/D2-262 Range A aaa bbb aaa bbbInputs X 0–777 – 0–1777 –Outputs Y 0–777 – 0–1777 –Control Relays C 0–1777 – 0–3777 –Stage bits S 0–1777 – 0–1777 –Timer bits T 0–377 – 0–377 –Counter bits CT 0–177 – 0–377 –Special Relays SP 0-777 – 0–777 –Global I/O GX/GY - – 0-3777 –Constant K - 1–32 - 1–32
DL205 User Manual, 5th Edition, Rev. B5-82
Chapter 5: Standard RLL Instructions
Exclusive Or with Stack (XORS)The Exclusive Or with Stack instruction is a 32-bit instruction that performs an Exclusive Or of the value in the accumulator with the first level of the accumulator stack. The result resides in the accumulator. The value in the first level of the accumulator stack is removed from the stack and all values are moved up one level. Discrete status flags indicate if the result of the Exclusive Or with Stack is zero or a negative number (the most significant bit is on).
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example, when X1 is on, the binary value in the accumulator will be Exclusive OR’d with the binary value in the first level of the accumulator stack. The result will reside in the accumulator.
XO R S
X1
0 0 1 0 1 0 0 0 0 1 1 1 1 0 1 0
0 1 0 0 0 0 1 0 0 1 0 0 0 0 1 00 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
V14002 8 7 A
0 1 1 0 0 0 1 0 0 0 1 1 1 0 0 1
0 1 0 1 0 1 0 0 0 1 1 1 1 1 1 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
Acc.
Acc.
V1500
4 2 4 2
V14015 4 7 E
V1501
6 2 3 9
0 1 0 1 0 1 0 0 0 1 1 1 1 1 1 0 0 0 1 0 1 0 0 0 0 1 1 1 1 0 1 0
0 1 1 0 1 0 1 0 0 0 1 1 1 0 0 00 0 1 1 0 1 1 0 0 1 0 0 0 1 1 1
Handheld Programmer Keystrokes
1B ENT
1B
4E
0A
0A ENT
STR$
SHFT ANDSTL
3D
OUTGX SHFT 3
D1
B5
F0
A0
A ENT
3D
ORQSHFT SET
X ENTSHFT RSTS
Copy the value in theaccumulator to V1500 and V1501
OUTD
V1500
Exclusive OR the valuein the accumulator with the value in thefirst level of the accumulator stack
LDD
V1400
Load the value in V1400 andV1401 into the accumulator
36476A38XOR (1st level of Stack)
XORS
DirectSOFT
�����
230
240
250-1
260
262
DS UsedHPP Used
Discrete Bit Flags DescriptionSP63 Will be on if the result in the accumulator is zeroSP70 Will be on if the result in the accumulator is negative
DL205 User Manual, 5th Edition, Rev. B 5-83
Chapter 5: Standard RLL Instructions
Compare (CMP)The compare instruction is a 16-bit instruction that compares the value in the lower 16 bits of the accumulator with the value in a specified V-memory location (Aaaa). The corresponding status flag will be turned on indicating the result of the comparison.
NOTE: The status flags are only valid until another instruction that uses the same flags is executed.
In the following example, when X1 is on, the constant 4526 will be loaded into the lower 16 bits of the accumulator using the Load instruction. The value in the accumulator is compared with the value in V2000 using the Compare instruction. The corresponding discrete status flag will be turned on indicating the result of the comparison. In this example, if the value in the accumulator is less than the value specified in the Compare instruction, SP60 will turn on, energizing contact C30.
CMPA aaa
Discrete Bit Flags DescriptionSP60 On when the value in the accumulator is less than the instruction value.SP61 On when the value in the accumulator is equal to the instruction value.SP62 On when the value in the accumulator is greater than the instruction value.
Handheld Programmer Keystrokes
V2000
Acc.
CONSTANT4 5 2 6 ?
8 9 4 5
0 0 0 0 4 5 2 64 5 2 6 ?
LD
Compare the value in theaccumulator with the valuein V2000
Load the constant value4526 into the lower 16 bits ofthe accumulator
K4526
CMP
X1
V2000
Compared with
SP60 C30
DirectSOFT
The unused accumulatorbits are set to zero
STR$
SHFT ANDSTL
3D SHFT JMP
K4
E5
F2
C6
G ENT
SHFT 2C
ORSTM
CVP
STR$ SHFT ENTSTRN
SP6
G0
A
OUTGX SHFT 2
C3
D0
A ENT
1B ENT
2C
0A
0A
0A ENTSHFT
OUT
DS UsedHPP Used
�����
230
240
250-1
260
262Operand Data
Type Range
D2-230 D2-240 D2-250-1 D2-260/D2-262 A aaa aaa aaa aaaV-memory V All; see Memory mapPointer P – All V-memory; see Memory map
DL205 User Manual, 5th Edition, Rev. B5-84
Chapter 5: Standard RLL Instructions
Compare Double (CMPD)The Compare Double instruction is a 32–bit instruction that compares the value in the accumulator with the value (Aaaa), which is either two consecutive V-memory locations or an 8–digit (max) constant. The corresponding status flag will be turned on indicating the result of the comparison.
NOTE: The status flags are only valid until another instruction that uses the same flags is executed.
In the following example, when X1 is on, the value in V2000 and V2001 will be loaded into the accumulator using the Load Double instruction. The value in the accumulator is compared with the value in V2010 and V2011 using the CMPD instruction. The corresponding discrete status flag will be turned on indicating the result of the comparison. In this example, if the value in the accumulator is less than the value specified in the Compare instruction, SP60 will turn on, energizing contact C30.
Handheld Programmer Keystrokes
LDD
Compare the value in theaccumulator with the valuein V2010 and V2011
Load the value in V2000 andV2001 into the accumulator
V2000
CMPD
X1
V2010
Compared with
SP60 C30
V2010
Acc.
V2000
4 5 2 6 7 7 ? 7 2 9 9
V20014 5 2 6 7 2 9 9
V2011
6 7 3 9 5 0 2 6
DirectSOFT
STR$
SHFT ANDSTL
3D
SHFT 2C
ORSTM
CVP
STR$ SHFT ENTSTRN
SP6
G0
A
OUTGX SHFT 2
C3
D0
A ENT
3D
3D
1B ENT
ENT
2C
0A
0A ENT
2C
0A
0A
0A
1BSHFT
OUT
CMPDA aaa
DS UsedHPP Used
�����
230
240
250-1
260
262Operand Data
Type Range
D2-230 D2-240 D2-250-1 D2-260/D2-262 A aaa aaa aaa aaaV-memory V All; see Memory mapPointer P – All V-memory; see Memory map
Constant K 0-FFFFFFFF 0-FFFFFFFF
Discrete Bit Flags DescriptionSP60 On when the value in the accumulator is less than the instruction value.SP61 On when the value in the accumulator is equal to the instruction value.SP62 On when the value in the accumulator is greater than the instruction value.
DL205 User Manual, 5th Edition, Rev. B 5-85
Chapter 5: Standard RLL Instructions
Compare Formatted (CMPF)The Compare Formatted compares the value in the accumulator with a specified number of discrete locations (1–32). The instruction requires a starting location (Aaaa) and the number of bits (Kbbb) to be compared. The corresponding status flag will be turned on indicating the result of the comparison.
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example, when X1 is on the Load Formatted instruction loads the binary value (6) from C10–C13 into the accumulator. The CMPF instruction compares the value in the accumulator to the value in Y20–Y23 (E hex). The corresponding discrete status flag will be turned on indicating the result of the comparison. In this example, if the value in the accumulator is less than the value specified in the Compare instruction, SP60 will turn on, energizing C30.
CMPF A aaa
K bbb
230
240
250-1
260
262
�����
K4C10
Location Constant C10C11C12C13OFFONONOFF
The unused accumulatorbits are set to zero
Y20Y21Y22Y23OFFONONON
Comparedwith
Acc. 0 0 0 0 0 0 0 6
E
LDF
Compare the value in theaccumulator with the valueof the specified discretelocation (Y20--Y23)
Load the value of thespecified discrete locations(C10--C13) into theaccumulator
C10K4
CMPF
X1
Y20K4
SP60 C30
OUT
DirectSOFT
Operand Data Type Range
D2-250-1 D2-260/D2-262 A aaa bbb aaa bbbInputs X 0–777 – 0–1777 –Outputs Y 0–777 – 0–1777 –Control Relays C 0–1777 – 0–3777 –Stage bits S 0–1777 – 0–1777 –Timer bits T 0–377 – 0–377 –Counter bits CT 0–177 – 0–377 –Special Relays SP 0-777 – 0–777 –Global I/O GX/GY - – 0-3777 –Constant K - 1–32 - 1–32
Discrete Bit Flags DescriptionSP60 On when the value in the accumulator is less than the first level value in the Accumulator Stack.SP61 On when the value in the accumulator is equal to the first level value in the Accumulator StackSP62 On when the value in the accumulator is greater than the first level value in the Accumulator Stack.
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B5-86
Chapter 5: Standard RLL Instructions
Compare with Stack (CMPS)The Compare with Stack instruction is a 32-bit instruction that compares the value in the accumulator with the value in the first level of the accumulator stack.
The corresponding status flag will be turned on indicating the result of the comparison. This does not affect the value in the accumulator.
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example when X1 is on, the value in V1400 and V1401 is loaded into the accumulator using the Load Double instruction. The value in V1410 and V1411 is loaded into the accumulator using the Load Double instruction. The value that was loaded into the accumulator from V1400 and V1401 is placed on top of the stack when the second Load instruction is executed. The value in the accumulator is compared with the value in the first level of the accumulator stack using the CMPS instruction. The corresponding discrete status flag will be turned on indicating the result of the comparison. In this example, if the value in the accumulator is less than the value in the stack, SP60 will turn on, energizing C30.
C MPS�����
230
240
250-1
260
262
X1
Acc. 6 5 0 0 3 5 4 4
V14003 5 4 4
SP60 C30OUT
V14016 5 0 0
Acc. 5 5 0 0 3 5 4 4
V14103 5 4 4
V14115 5 0 0
Handheld Programmer Keystrokes
STR$
SHFT ANDSTL
3D
SHFT 2C
ORSTM
CVP
STR$
STRNSP
OUTGX
3D
RSTS
1B ENT
ENTSHFT
1B
4E
0A
0A ENT
SHFT ANDSTL
3D
3D
1B
4E
1B
0A ENT
SHFT
Compared withTop of Stack
LDDV1400
LDD
V1410
CMPS
Load the value in V1400 andV1401 into the accumulator
Load the value in V1410 andV1411 into the accumulator
Compare the value in theaccumulator with the valuein the first level of theaccumulator stack
DirectSOFT
ENT0ASHFT
2C
3D
0A
6G
ENT
Discrete Bit Flags DescriptionSP60 On when the value in the Accumulator is less than the first level value in the
Accumulator StackSP61 On when the value in the Accumulator is equal to the first level value in the
Accumulator StackSP62 On when the value in the Accumulator is greater than the first level value in the
Accumulator Stack
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-87
Chapter 5: Standard RLL Instructions
Compare Real Number (CMPR)The Compare Real Number instruction compares a real number value in the accumulator with two consecutive V-memory locations containing a real number. The corresponding status flag will be turned on indicating the result of the comparison. Both numbers being compared are 32 bits long.
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example, when X1 is on, the LDR instruction loads the real number representation for 7 decimal into the accumulator. The CMPR instruction compares the accumulator contents with the real representation for decimal 6. Since 7 > 6, the corresponding discrete status flag is turned on (special relay SP62).
Discrete Bit Flags DescriptionSP60 On when the value in the accumulator is less than the instruction value.SP61 On when the value in the accumulator is equal to the instruction value.SP62 On when the value in the accumulator is greater than the instruction value.SP71 On anytime the V-memory specified by a pointer (P) is not validSP75 On when a real number instruction is executed and a non-real number encountered.
CMPRA aaa
X1
0 0 0 0
4 0 D 0 0 0 0 0
4 0 E 0
DirectSOFT
SP62
LDR
R7.0
CMPRR6.0
C1
OUT
CMPR
Acc.
Load the real number representation for decimal 7into the accumulator
Compare the value with thereal number representation for decimal 6
Operand Data Type Range
D2-250-1 D2-260/D2-262A aaa aaa
V-memory V All. See memory map
All. See memory map
Pointer P All V-memory. See memory map
All V-memory. See memory map
Constant R -3.402823E+038 to + 3.402823E+038
-3.402823E+038 to + 3.402823E+038
230
240
250-1
260
262
�����DS Used
HPP N/A
DL205 User Manual, 5th Edition, Rev. B5-88
Chapter 5: Standard RLL Instructions
Math InstructionsAdd (ADD)
Add is a 16-bit instruction that adds a BCD value in the accumulator with a BCD value in a V-memory location (Aaaa). (You cannot use a constant (K) as the BCD value in the box.) The result resides in the accumulator.
NOTE: The status flags are only valid until another instruction that uses the same flags is executed.
In the following example, when X1 is on, the value in V2000 will be loaded into the accumulator using the Load instruction. The value in the lower 16 bits of the accumulator are added to the value in V2006 using the Add instruction. The value in the accumulator is copied to V2010 using the Out instruction.
ADDA aaa
DirectSOFT
Handheld Programmer Keystrokes
LDV2000
X1
Load the value in V2000 intothe lower 16 bits of theaccumulator
ADDV2006
Add the value in the lower16 bits of the accumulatorwith the value in V2006
OUTV2010
Copy the value in the lower16 bits of the accumulator toV2010
V2010
V20004 9 3 5
7 4 3 5
0 0 0 0 4 9 3 5
+ 2 5 0 0
Acc. 7 4 3 5
(V2006)
(Accumulator)
The unused accumulatorbits are set to zero
SHFT ANDSTL
3D
STR$
SHFT 0A
3D
3D
OUTGX SHFT AND
V2
C0
A1
B0
A ENT
1B ENT
2C
0A
0A
0A ENT
2C
0A
0A ENT6
G
Discrete Bit Flags DescriptionSP63 On when the result of the instruction causes the value in the accumulator to be zeroSP66 On when the 16-bit addition instruction results in a carrySP67 On when the 32-bit addition instruction results in a carrySP70 On anytime the value in the accumulator is negativeSP75 On when a BCD instruction is executed and a NON-BCD number is encountered
DS UsedHPP Used
�����
230
240
250-1
260
262Operand Data
Type Range
D2-230 D2-240 D2-250-1 D2-260/D2-262 A aaa aaa aaa aaaV-memory V All; see Memory mapPointer P – All V-memory; see Memory map
DL205 User Manual, 5th Edition, Rev. B 5-89
Chapter 5: Standard RLL Instructions
Add Double (ADDD)Add Double is a 32-bit instruction that adds the BCD value in the accumulator with a BCD value (Aaaa), which is either two consecutive V-memory locations or an 8–digit (max) BCD constant. The result resides in the accumulator.
NOTE: The status flags are only valid until another instruction that uses the same flags is executed.
In the following example, when X1 is on, the value in V2000 and V2001 will be loaded into the accumulator using the Load Double instruction. The value in the accumulator is added with the value in V2006 and V2007 using the Add Double instruction. The value in the accumulator is copied to V2010 and V2011 using the Out Double instruction.
ADDDA aaa
6 7 3 9 5 0 2 6
DirectSOFT
Handheld Programmer Keystrokes
LDDV2000
X1
Load the value in V2000 andV2001 into the accumulator
ADDDV2006
Add the value in theaccumulator with the valuein V2006 and V2007
OUTDV2010
Copy the value in theaccumulator to V2010 andV2011
V2010
V2000
V20016 7 3 9 5 0 2 6
V2011
8 7 3 9 9 0 7 2
(V2006 and V2007)
(Accumulator)
2 0 0 0 4 0 4 6+
8 7 3 9 9 0 7 2Acc.
STR$
1B
SHFT 0A
3D
3D
SHFT ANDSTL
3D
3D
3D
OUTGX SHFT 3
DAND
V2
C0
A1
B0
A ENTSHFT
ENT
2C
0A
0A ENT6
G
2C
0A
0A
0A ENT
Discrete Bit Flags DescriptionSP63 On when the result of the instruction causes the value in the accumulator to be zeroSP66 On when the 16-bit addition instruction results in a carrySP67 On when the 32-bit addition instruction results in a carrySP70 On anytime the value in the accumulator is negativeSP75 On when a BCD instruction is executed and a NON-BCD number is encountered
DS UsedHPP Used
�����
230
240
250-1
260
262 Operand Data Type
RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
A aaa aaa aaa aaaV-memory V All; see Memory mapPointer P – All V-memory; see Memory map
Constant K 0-99999999 0-99999999
DL205 User Manual, 5th Edition, Rev. B5-90
Chapter 5: Standard RLL Instructions
Add Real (ADDR)Add Real is a 32-bit instruction that adds a real number, which is either two consecutive V-memory locations or a 32-bit constant, to a real number in the accumulator. Both numbers must conform to the IEEE floating point format. The result is a 32-bit real number that resides in the accumulator.
NOTE: Status flags are valid only until another instruction uses the same flag.
NOTE 1: The current HPP does not support real number entry with automatic conversion to the 32-bit IEEE format. You must use DirectSOFT for this feature. NOTE 2: If the value being added to a real number is 16,777,216 times smaller than the real number, the calculation will not work.
Discrete Bit Flags DescriptionSP63 On when the result of the instruction causes the value in the accumulator to be zeroSP70 On anytime the value in the accumulator is negativeSP71 On anytime the V-memory specified by a pointer (P) is not validSP72 On anytime the value in the accumulator is an invalid floating point numberSP73 On when a signed addition or subtraction results in a incorrect sign bitSP74 On anytime a floating point math operation results in an underflow errorSP75 On when a real number instruction is executed and a non-real number was encountered
ADDRA aaa
ADDRA aaa
230
240
250-1
260
262
�����
LDR
R7.0
X1
Load the real number 7.0into the accumulator
ADDR
R15.0
Add the real number 15.0 tothe accumulator contents,which is in real numberformat.
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 1 0 0 0 0 0 1 1 0 1 1 0 0 0 0
8 4 2 1 8 4 2 1 8 4 2 1 8 4 2 18 4 2 1 8 4 2 1 8 4 2 1 8 4 2 1
Acc.
4 1 B 0 0 0 0 0
V1400V1401
Real Value
Copy the result in the accumulatorto V1400 and V1401.
OUTD
V1400
Implies 2 (exp 4)131 -- 127 = 4
(Hex number)
Mantissa (23 bits)Sign Bit
4 0 E 0 0 0 0 0
0 0 0 04 0 E 0
(ADDR)
(Accumulator)
4 1 7 0 0 0 0 0+
0 0 0 04 1 B 0Acc.
7 (decimal)
+ 1 5
2 2
1.011 x 2 (exp 4) = 10110. binary= 22 decimal128 + 2 + 1 = 131
Exponent (8 bits)
DirectSOFT
Operand Data Type Range
D2-250-1 D2-260/D2-262 A aaa aaa
V-memory V All. See memory map
All. See memory map
Pointer P All V-memory. See memory map
All V-memory. See memory map
Constant R -3.402823E+038 to + 3.402823E+038
-3.402823E+038 to + 3.402823E+038
DS UsedHPP N/A
DL205 User Manual, 5th Edition, Rev. B 5-91
Chapter 5: Standard RLL Instructions
Subtract (SUB)Subtract is a 16-bit instruction that subtracts the BCD value (Aaaa) in a V-memory location from the BCD value in the lower 16 bits of the accumulator. The result resides in the accumulator.
NOTE: A constant (K) cannot be used for the BCD value. Status flags are only valid until another instruction that uses the same flags is executed.
In the following example, when X1 is on, the value in V2000 will be loaded into the accumulator using the Load instruction. The value in V2006 is subtracted from the value in the accumulator using the Subtract instruction. The value in the accumulator is copied to V2010 using the Out instruction.
Standard R
LLInstructions
5–91
SUBA aaa
DirectSOFT
Handheld Programmer Keystrokes
LDV2000
X1
Load the value in V2000 intothe lower 16 bits of theaccumulator
SUBV2006
Subtract the value in V2006from the value in the lower16 bits of the accumulator
OUTV2010
Copy the value in the lower16 bits of the accumulator toV2010
V2010
0 2
1 (V2006)
(Accumulator)
2
0
0
V20004 7 5
8 8 3
0 0 0 4 7 5
5 9 2
Acc. 8 8 3
The unused accumulatorbits are set to zero
SHFT ANDSTL
3D
STR$
SHFT SHFT ANDV
2C
0A
0A ENT6
G
OUTGX SHFT AND
V2
C0
A1
B0
A ENT
RSTS
ISGU
1B
1B ENT
2C
0A
0A
0A ENT
_
DS UsedHPP Used
�����
230
240
250-1
260
262Operand Data
Type Range
D2-230 D2-240 D2-250-1 D2-260/D2-262 A aaa aaa aaa aaaV-memory V All; see Memory mapPointer P – All V-memory; see Memory map
Discrete Bit Flags DescriptionSP63 On when the result of the instruction causes the value in the accumulator to be zeroSP66 On when the 16-bit addition instruction results in a carrySP67 On when the 32-bit addition instruction results in a carrySP70 On anytime the value in the accumulator is negativeSP75 On when a BCD instruction is executed and a NON-BCD number is encountered
DL205 User Manual, 5th Edition, Rev. B5-92
Chapter 5: Standard RLL Instructions
Subtract Double (SUBD)Subtract Double is a 32-bit instruction that subtracts the BCD value (Aaaa), which is either two consecutive V-memory locations or an 8-digit (max) constant, from the BCD value in the accumulator. The result resides in the accumulator.
NOTE: The status flags are only valid until another instruction that uses the same flags is executed.
In the following example, when X1 is on, the value in V2000 and V2001 will be loaded into the accumulator using the Load Double instruction. The value in V2006 and V2007 is subtracted from the value in the accumulator. The value in the accumulator is copied to V2010 and V2011 using the Out Double instruction.
Operand Data Type RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
A aaa aaa aaa aaaV-memory V All (See page 3 - 54) All (See page 3-55) All (See page 3-56) All (See page 3-57)
Pointer P -All V-memory
(See page 3-55)All V-memory
(See page 3-56)All V-memory
(See page 3-57)Constant K 0-99999999 0-99999999 0-99999999 0-99999999
SUBDA aaa
DirectSOFT
Handheld Programmer Keystrokes
LDDV2000
X1
Load the value in V2000 andV2001 into the accumulator
SUBDV2006
The value in V2006 and V2007is subtracted from the value inthe accumulator
OUTDV2010
Copy the value in theaccumulator to V2010 andV2011
0 0 3 9 0 8 9 9
0 1 0 6 3 2 7 4
0 1 0 6 3 2 7 4
V2010
V2000V2001
V2011
0 0 3 9 0 8 9 9
6 7 2 3 7 5
ACC.
STR$
SHFT
SHFT ANDSTL
3D
3D
3D
OUTGX SHFT 3
D
RSTS
ISGU
1B
1B ENT
2C
0A
0A ENT6
G
2C
0A
0A
0A ENT
2C
0A
1B
0A ENT
SHFT
_
DS UsedHPP Used
�����
230
240
250-1
260
262
Discrete Bit Flags DescriptionSP63 On when the result of the instruction causes the value in the accumulator to be zeroSP66 On when the 16-bit addition instruction results in a carrySP67 On when the 32-bit addition instruction results in a carrySP70 On anytime the value in the accumulator is negativeSP75 On when a BCD instruction is executed and a NON-BCD number is encountered
DL205 User Manual, 5th Edition, Rev. B 5-93
Chapter 5: Standard RLL Instructions
Subtract Real (SUBR)The Subtract Real is a 32-bit instruction that subtracts a real number, which is either two consecutive V-memory locations or a 32-bit constant, from a real number in the accumulator. The result is a 32-bit real number that resides in the accumulator. Both numbers must be Real data type (IEEE floating point format).
NOTE: Status flags are valid only until another instruction uses the same flag.
NOTE: The current HPP does not support real number entry with automatic conversion to the 32-bit IEEE format. You must use DirectSOFT for this feature.
SUBRA aaa
230
240
250-1
260
262
�����
ndar
dR
LLst
ruct
ions
LDRR22.0
X1
SUBRR15.0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0
8 4 2 1 8 4 2 1 8 4 2 1 8 4 2 18 4 2 1 8 4 2 1 8 4 2 1 8 4 2 1
Acc.
4 0 E 0 0 0 0 0
V1400V1401
Real Value
OUTDV1400
Implies 2 (exp 2)129 -- 127 = 2
(Hex number)
Mantissa (23 bits)Sign Bit
4 1 B 0 0 0 0 0
0 0 0 04 1 B 0
(SUBR)
(Accumulator)
4 1 7 0 0 0 0 0_
0 0 0 04 0 E 0Acc.
2 2 (decimal)_ 1 5
7
1.11 x 2 (exp 2) = 111. binary= 7 decimal128 + 1 = 129
Exponent (8 bits)
DirectSOFT
Load the real number22.0 into the accumulator.
Subtract the real number15.0 from the accumulatorcontents, which is in realnumber format.
Copy the result in theaccumulator to V1400and V1401.
Operand Data Type Range
D2-250-1 D2-260/D2-262 A aaa aaaV-memory V All. (See page 3-56) All. (See page 3-57)Pointer P All V-memory (See page 3-56) All V-memory (See page 3-57)
Constant R -3.402823E+038 to + 3.402823E+038
-3.402823E+038 to + 3.402823E+038
DS UsedHPP N/A
Discrete Bit Flags DescriptionSP63 On when the result of the instruction causes the value in the accumulator to be zeroSP70 On anytime the value in the accumulator is negativeSP71 On anytime the V-memory specified by a pointer (P) is not validSP72 On anytime the value in the accumulator is an invalid floating point numberSP73 On when a signed addition or subtraction results in a incorrect sign bitSP74 On anytime a floating point math operation results in an underflow errorSP75 On when a real number instruction is executed and a non-real number was encountered
DL205 User Manual, 5th Edition, Rev. B5-94
Chapter 5: Standard RLL Instructions
Multiply (MUL)Multiply is a 16-bit instruction that multiplies the BCD value (Aaaa), which is either a V-memory location or a 4–digit (max) constant, by the BCD value in the lower 16 bits of the accumulator The result can be up to 8 digits and resides in the accumulator.
NOTE: The status flags are only valid until another instruction that uses the same flags is executed.
In the following example, when X1 is on, the value in V2000 will be loaded into the accumulator using the Load instruction. The value in V2006 is multiplied by the value in the accumulator. The value in the accumulator is copied to V2010 and V2011 using the Out Double instruction.
MULA aaa
DirectSOFT
Handheld Programmer Keystrokes
LDV2000
X1
Load the value in V2000 intothe lower 16 bits of theaccumulator
MULV2006
The value in V2006 ismultiplied by the value in theaccumulator
OUTDV2010
Copy the value in theaccumulator to V2010 andV2011
0 0 0 2 5 0 0 0
0
X
0 0 0 0 1 0 0 0
1
V2000 0
0 0 0 2 5 0 0 0
2 5
The unused accumulatorbits are set to zero
Acc.
STR$
SHFT ANDSTL
3D
SHFT ORSTM
ISGU
ANDSTL
OUTGX SHFT 3
D
1B ENT
2C
0A
0A
0A ENT
2C
0A
0A ENT6
G
2C
0A
1B
0A ENT
0
V2011
(Accumulator)(V2006)
V2010
DS UsedHPP Used
�����
230
240
250-1
260
262
Operand Data Type RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
A aaa aaa aaa aaaV-memory V All (See page 3 - 54) All (See page 3-55) All (See page 3-56) All (See page 3-57)
Pointer P -All V-memory
(See page 3-55)All V-memory
(See page 3-56)All V-memory
(See page 3-57)Constant K 0-9999 0-99999999 0-9999 0-9999
Discrete Bit Flags DescriptionSP63 On when the result of the instruction causes the value in the accumulator to be zeroSP70 On anytime the value in the accumulator is negativeSP75 On when a BCD instruction is executed and a NON-BCD number is encountered
DL205 User Manual, 5th Edition, Rev. B 5-95
Chapter 5: Standard RLL Instructions
Multiply Double (MULD)Multiply Double is a 32-bit instruction that multiplies the 8-digit BCD value in the accumulator by the 8-digit BCD value in the two consecutive V-memory locations specified in the instruction. The lower 8 digits of the results reside in the accumulator. Upper digits of the result reside in the accumulator stack.
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example, when X1 is on, the constant Kbc614e hex will be loaded into the accumulator. When converted to BCD the number is ”12345678”. That number is stored in V1400 and V1401. After loading the constant K2 into the accumulator, we multiply it times 12345678, which is 24691356.
MULDA aaa
Operand Data TypeRange
D2-250-1 D2-260/D2-262 A aaa aaaV-memory V All V-mem (See page 3-56) All V-mem (See page 3-57)Pointer P All V-mem (See page 3-56) All V-mem (See page 3-57)
230
240
250-1
260
262
�����
DirectSOFT
Handheld Programmer Keystrokes
LDDKbc614e
X1 Load the hex equivalentof 12345678 decimal intothe accumulator.
BCDConvert the value toBCD format. It willoccupy eight BCD digits(32 bits).
OUTDV1400
Output the number toV1400 and V1401 usingthe OUTD instruction. 3 5 62 4 6 9
6 7 8
(Accumulator)1 2 3 4 5 6 7 8
1
(Accumulator)
V1402
1
5V1400
3 5 6
V1403
2 4 6 9
2
Acc.
LDK2
Load the constant K2into the accumulator.
MULDV1400
Multiply the accumulatorcontents (2) by the8-digit number in V1400and V1401.
OUTDV1402
Move the result in theaccumulator to V1402and V1403 using theOUTD instruction.
2 3 41V1401
STR$
SHFT ANDSTL
3D
SHFT ORSTM
ISGU
ANDSTL
OUTGX SHFT 3
D
1B ENT
6G
1B
4E ENT
ENT
ENT
3D PREV SHFT 1
B2
C SHFT SHFT 4E
SHFT 1B
2C
3D
OUTGX SHFT 3
D1
B4
E0
A ENT0A
ENT
SHFT ANDSTL
3D PREV ENT2
C
3D
1B
4E
0A
0A
1B
4E
0A
2C
X
DS UsedHPP Used
Discrete Bit Flags DescriptionSP63 On when the result of the instruction causes the value in the accumulator to be zeroSP70 On anytime the value in the accumulator is negativeSP75 On when a BCD instruction is executed and a NON-BCD number is encountered
DL205 User Manual, 5th Edition, Rev. B5-96
Chapter 5: Standard RLL Instructions
Multiply Real (MULR)The Multiply Real instruction multiplies a real number in the accumulator with either a real constant or a real number occupying two consecutive V-memory locations. The result resides in the accumulator. Both numbers must be Real data type (IEEE floating point format).
NOTE: Status flags are valid only until another instruction uses the same flag.
NOTE: The current HPP does not support real number entry with automatic conversion to the 32-bit IEEE format. You must use DirectSOFT for this feature.
MULR
A aaa
DirectSOFT
LDRR 7.0
X1
Load the real number 7.0into the accumulator.
MULRR 15.0
Multiply the accumulatorcontents by the real number15.0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 1 0 0 0 0 1 0 1 1 0 1 0 0 1 0
8 4 2 1 8 4 2 1 8 4 2 1 8 4 2 18 4 2 1 8 4 2 1 8 4 2 1 8 4 2 1
Acc.
4 2 D 2 0 0 0 0
V1400V1401
Real Value
Copy the result in the accumulatorto V1400 and V1401.
OUTDV1400
Implies 2 (exp 6)133 -- 127 = 6
(Hex number)
Sign Bit
4 0 E 0 0 0 0 0
0 0 0 04 0 E 0
(MULR)
(Accumulator)
4 1 7 0 0 0 0 0X
0 0 0 04 2 D 2Acc.
7 (decimal)
x 1 5
1 0 5
1.101001 x 2 (exp 6) = 1101001. binary= 105 decimal128 + 4 + 1 = 133
Exponent (8 bits) Mantissa (23 bits)
230
240
250-1
260
262
�����
Operand Data Type Range
D2-250-1 D2-260/D2-262 A aaa aaaV-memory V All. (See page 3-56) All. (See page 3-57)Pointer P All V-memory (See page 3-56) All V-memory (See page 3-57)
Constant R -3.402823E+038 to + 3.402823E+038
-3.402823E+038 to + 3.402823E+038
DS UsedHPP N/A
Discrete Bit Flags DescriptionSP63 On when the result of the instruction causes the value in the accumulator to be zeroSP70 On anytime the value in the accumulator is negativeSP71 On anytime the V-memory specified by a pointer (P) is not validSP72 On anytime the value in the accumulator is an invalid floating point numberSP73 On when a signed addition or subtraction results in a incorrect sign bitSP74 On anytime a floating point math operation results in an underflow errorSP75 On when a real number instruction is executed and a non-real number was encountered
DL205 User Manual, 5th Edition, Rev. B 5-97
Chapter 5: Standard RLL Instructions
Divide (DIV)Divide is a 16-bit instruction that divides the BCD value in the accumulator by a BCD value (Aaaa), which is either a V-memory location or a 4-digit (max) constant. The first part of the quotient resides in the accumulator, and the remainder resides in the first stack location.
NOTE: The status flags are only valid until another instruction that uses the same flags is executed.
In the following example, when X1 is on, the value in V2000 will be loaded into the accumulator using the Load instruction. The value in the accumulator will be divided by the value in V2006 using the Divide instruction. The value in the accumulator is copied to V2010 using the Out instruction.
DIVA aaa
Discrete Bit Flags Description SP53 On when the value of the operand is larger than the accumulator can work withSP63 On when the result of the instruction causes the value in the accumulator to be zeroSP70 On anytime the value in the accumulator is negativeSP75 On when a BCD instruction is executed and a NON-BCD number was encountered
DirectSOFT
Handheld Programmer Keystrokes
LDV2000
X1
Load the value in V2000 intothe lower 16 bits of theaccumulator
DIVV2006
The value in theaccumulator is divided bythe value in V2006
OUTV2010
Copy the value in the lower16 bits of the accumulator toV2010
V2010
5
(V2006)
(Accumulator)0
5V20000 0 0
1 0 0
0 0 0 0 0 0
5 0
Acc. 1 0 0
The unused accumulatorbits are set to zero
0 0 00 0 0 0 0
First stack location contains the remainder
STR$
SHFT ANDSTL
3D
SHFT 3D
8I
ANDV
OUTGX SHFT AND
V2
C0
A1
B0
A ENT
1B ENT
2C
0A
0A
0A ENT
2C
0A
0A ENT6
G
÷
DS UsedHPP Used
�����
230
240
250-1
260
262
Operand Data Type RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
A aaa aaa aaa aaaV-memory V All (See page 3-54) All (See page 3-55) All (See page 3-56) All (See page 3-57)
Pointer P -All V-memory
(See page 3-55)All V-memory
(See page 3-56)All V-memory
(See page 3-57)Constant K 1-9999 1-9999 1-9999 1-9999
DL205 User Manual, 5th Edition, Rev. B5-98
Chapter 5: Standard RLL Instructions
Divide Double (DIVD)Divide Double is a 32-bit instruction that divides the BCD value in the accumulator by a BCD value (Aaaa), which must be obtained from two consecutive V-memory locations (You cannot use a constant as the parameter in the box). The first part of the quotient resides in the accumulator, and the remainder resides in the first stack location.
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example, when X1 is on, the value in V1400 and V1401 will be loaded into the accumulator using the Load Double instruction. The value in the accumulator is divided by the value in V1420 and V1421 using the Divide Double instruction. The first part of the quotient resides in the accumulator and the remainder resides in the first stack location. The value in the accumulator is copied to V1500 and V1501 using the Out Double instruction.
DIVDA aaa
Sta
ndar
d R
LLIn
stru
ctio
ns
DirectSOFT
Handheld Programmer Keystrokes
LDDV1400
X1
Load the value in V1400 andV1401 into the accumulator
DIVDV1420
The value in the accumulatoris divided by the value inV1420 and V1421
OUTDV1500
Copy the value in theaccumulator to V1500and V1501
0 0 00 0 0 3
0 0 00 1 5 0
0 (Accumulator)
(V1421 and V1420)
0
÷ 0
1 5 0 0 0 0 0
0
V1500
V1400
0
0 0 0
V1401
V1501
0 0 0 3
0 0 0 0 0 5 0
0 0 00 0 0 0 0
First stack location contains the remainder
The unused accumulatorbits are set to zero
Acc.
STR$
SHFT ANDSTL
3D
SHFT 3D
8I
ANDV
OUTGX SHFT 0
A ENT
1B ENT
2C ENT0
A
3D ENT1
B4
E0
A0
A
1B
4E
3D
1B
5F
0A
Operand Data TypeRange
D2-250-1 D2-260/D2-262 A aaa aaaV-memory V All V-memory (See page 3-56) All V-memory (See page 3-57)Pointer P All V-memory (See page 3-56) All V-memory (See page 3-57)
230
240
250-1
260
262
�����DS Used
HPP Used
Discrete Bit Flags Description SP53 On when the value of the operand is larger than the accumulator can work withSP63 On when the result of the instruction causes the value in the accumulator to be zeroSP70 On anytime the value in the accumulator is negativeSP75 On when a BCD instruction is executed and a NON-BCD number was encountered
DL205 User Manual, 5th Edition, Rev. B 5-99
Chapter 5: Standard RLL Instructions
Divide Real (DIVR)The Divide Real instruction divides a real number in the accumulator by either a real constant or a real number occupying two consecutive V-memory locations. The result resides in the accumulator. Both numbers must conform to the IEEE floating point format.
NOTE: Status flags are valid only until another instruction uses the same flag.
NOTE: The current HPP does not support real number entry with automatic conversion to the 32-bit IEEE format. You must use DirectSOFT for this feature.
DIVRA aaa
ndar
dR
LL
LDRR15.0
X1
Load the real number 15.0into the accumulator.
DIVRR10.0
Divide the accumulator contentsby the real number 10.0.
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 00 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0
8 4 2 1 8 4 2 1 8 4 2 1 8 4 2 18 4 2 1 8 4 2 1 8 4 2 1 8 4 2 1
Acc.
3 F C 0 0 0 0 0
V1400V1401
Real Value
Copy the result in the accumulatorto V1400 and V1401.
OUTDV1400
Implies 2 (exp 0)127 -- 127 = 0
(Hex number)
Mantissa (23 bits)Sign Bit
4 1 7 0 0 0 0 0
0 0 0 04 1 7 0
(DIVR )
(Accumulator)
4 1 2 0 0 0 0 0÷
0 0 0 03 F C 0Acc.
1 5 (decimal)
1 0
1
1.1 x 2 (exp 0) = 1.1 binary= 1.5 decimal64 + 32 + 16 + 8 + 4 + 2 + 1 = 127
Exponent (8 bits)
÷
5.
DirectSOFT
Operand Data TypeRange
D2-250-1 D2-260/D2-262 A aaa aaaV-memory V All (See page 3-56) All (See page 3-57)Pointer P All V-mem (See page 3-56) All V-mem (See page 3-57)
Constant R-3.402823E + 038 to+ 3.402823E + 038
-3.402823E + 038 to+ 3.402823E + 038
230
240
250-1
260
262
�����DS Used
HPP N/A
Discrete Bit Flags DescriptionSP63 On when the result of the instruction causes the value in the accumulator to be zeroSP70 On anytime the value in the accumulator is negativeSP71 On anytime the V-memory specified by a pointer (P) is not validSP72 On anytime the value in the accumulator is an invalid floating point numberSP73 On when a signed addition or subtraction results in a incorrect sign bitSP74 On anytime a floating point math operation results in an underflow errorSP75 On when a real number instruction is executed and a non-real number was encountered
DL205 User Manual, 5th Edition, Rev. B5-100
Chapter 5: Standard RLL Instructions
Increment (INC)The Increment instruction increments a BCD value in a specified V-memory location by “1” each time the instruction is executed.
Decrement (DEC)The Decrement instruction decrements a BCD value in a specified V-memory location by “1” each time the instruction is executed.
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following increment example, the value in V1400 increases by one each time that C5 is closed (true).
In the following decrement example, the value in V1400 is decreased by one each time that C5 is closed (true).
NOTE: Use a pulsed contact closure to INC/DEC the value in V–memory once per closure.
A aaaINC
Discrete Bit Flags Description SP63 On when the result of the instruction causes the value in the accumulator to be zero.SP75 On when a BCD instruction is executed and a NON-BCD number was encountered.
DirectSOFT
C5 INCV1400
Increment the value inV1400 by “1”.
V1400
8 9 3 5
V1400
8 9 3 6Handheld Programmer Keystrokes
STR$
5F ENT
8I ENT
NEXT NEXT NEXT NEXT
SHFT TMRN
1B
4E
0A
0A
2C
CVPSHFT
3D
A aaaDEC
230
240
250-1
260
262
�����
Operand Data TypeRange
D2-250-1 D2-260/D2-262 A aaa aaaV-memory V All V mem (See page 3-56) All V-mem (See page 3-57)Pointer P All V mem (See page 3-56) All V-mem (See page 3-57)
DS UsedHPP Used
DirectSOFT
C5 DECV1400
Decrement the value inV1400 by “1”.
V1400
8 9 3 5
V1400
8 9 3 4Handheld Programmer Keystrokes
STR$
5F ENT
3D ENT
NEXT NEXT NEXT NEXT
SHFT 4E
1B
4E
0A
0A
2C
CVPSHFT 3
D
DL205 User Manual, 5th Edition, Rev. B 5-101
Chapter 5: Standard RLL Instructions
Add Binary (ADDB)The Add Binary instruction adds a 16-bit number (Aaaa) to the value stored in the accumulator. The number in the accumulator can be up to 32 bits long. The source of the 16-bit operand can be a constant or a data value located in V-memory. Add Binary performs the addition operation on the full binary representation of the operands, which distinguishes it from the Add instruction (see page 5-88), which treats the operands as BCD numbers. Although the addition operation is performed on the underlying binary values, the native display format is hexadecimal. For that reason you will need to load constants in hex.
The sum of the Add Binary operation occupies the full 32-bit accumulator and requires an Out Double to move the sum to V-memory. If the value in the accumulator occupies fewer than 32 bits, leading zeros are loaded in the left-most empty bit positions.
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example, when X1 is on, the value in V1400 will be loaded into the accumulator using the Load instruction. The binary value in V1420 is added to the binary value in the accumulator using the Add Binary instruction. The value in the accumulator is copied to V1500 - V1501 using the Out Double instruction.
ADDBA aaa
Discrete Bit Flags Description SP63 On when the result of the instruction causes the value in the accumulator to be zeroSP66 On when the 16-bit addition instruction results in a carrySP67 On when the 32-bit addition instruction results in a carrSP70 On anytime the value in the accumulator is negativeSP73 On when a signed addition or subtraction results in an incorrect sign bit.
HandheldProgrammer Keystrokes
LDX1
+ 1
1
(Accumulator)00
1
0 A 0 5
C C 9
0 0 0 A 0 5
2 C 4
Acc. C C 9
STR 1
D 1 4 0 0
OUT 1 5 0 0
1 4 0A 2SHFT B
The unused accumulatorbits are set to zero
SHFT D
ENT
SHFT L ENT
D D ENT
ENT
Load the value in V1400into the lower 16 bits ofthe accumulator
LD
BIN
ADDB
OUTDV1500
K2565
Use either OR ConstantV-memory
V1420
V1400
(V1420)
V1500
V1400
The binary value in theaccumulator is added to thebinary value in V1420
Copy the value in the lower16bits of the accumulator toV1500 and V1501
DirectSOFT
A05 (Hex) = 2565 (decimal)
12C4 (Hex) = 4804 (decimal)
(Accumulator) 1CC9 (Hex) = 7369 (decimal)
Operand Data TypeRange
D2-250-1 D2-260/D2-262 A aaa aaaV-memory V All (See page 3-56) All (See page 3-57)Pointer P All V-mem (See page 3-56) All V-mem (See page 3-57)Constant K 0-FFFF 0-FFFF
230
240
250-1
260
262
�����DS Used
HPP Used
DL205 User Manual, 5th Edition, Rev. B5-102
Chapter 5: Standard RLL Instructions
Add Binary Double (ADDBD)Add Binary Double is a 32-bit instruction that adds the binary value in the accumulator with the value (Aaaa), which is either two consecutive V-memory locations or an 8-digit (max.) binary constant. The result resides in the accumulator.
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example, when X1 is on, the value in V1400 and V1401 will be loaded into the accumulator using the Load Double instruction. The binary value in the accumulator is added with the binary value in V1420 and V1421 using the Add Binary Double instruction. The value in the accumulator is copied to V1500 and V1501 using the Out Double instruction.
�����
230
240
250-1
260
262
ADDBDA aaa
LDDV1400
X1
ADDBDV1420
The binary value in theaccumulator is added with thevalue in V1420 and V1421
OUTDV1500
Copy the value in theaccumulator to V1500and V1501
1 11 0 0 0
0 10 0 0 0
A
A
(Accumulator)
+ 1
0
0 0
C
0 0 A 0 1
V1500
0
(V1421 and V1420)
C
V1400
A 1 1
V1401
V1501
1 0 0 0
0 0 0 C 0 1 0
Acc.
Load the value in V1400and V1401 into theaccumulator
LDD
BIN
K2561
Use either OR ConstantV-memoryDirectSOFT
STR
LD
OUT
ADD
SHFT D SHFT
SHFT D SHFT
SHFT D SHFT
B
Handheld Programmer Keystrokes
1
1
1
4 0 0
21 4 0
5 00
Discrete Bit Flags Description SP63 On when the result of the instruction causes the value in the accumulator to be zeroSP66 On when the 16-bit addition instruction results in a carrySP67 On when the 32-bit addition instruction results in a carrySP70 On anytime the value in the accumulator is negativeSP73 On when a signed addition or subtraction results in an incorrect sign bit
DS UsedHPP Used
Operand Data Type Range D2-260/D2-262
A aaaV-memory V All (See page 3-57)Pointer P All V mem (See page 3-57)Constant K 0-FFFFFFFF
DL205 User Manual, 5th Edition, Rev. B 5-103
Chapter 5: Standard RLL Instructions
Subtract Binary (SUBB)The Subtract Binary instruction subtracts a 16-bit number (Aaaa) from the value stored in the accumulator. The number in the accumulator can be up to 32 bits long. The source of the 16-bit operand can be a constant or a data value located in V-memory. Subtract Binary performs the subtraction operation on the full binary representation of the operands, which distinguishes it from the Subtract instruction (see page 5-91), which treats the operands as BCD numbers. Although the subtraction operation is performed on the underlying binary values, the native display format is hexadecimal. For that reason, you will need to load constants in hex.
The difference (result) of the Subtract Binary operation occupies the full 32 bits of the accumulator and requires an Out Double to move the value to V-memory. If the value in the accumulator occupies fewer than 32 bits, leading zeros are loaded in the left-most empty bit positions of the accumulator.
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example, when X1 is on, the value in V1400 will be loaded into the accumulator using the Load instruction. The binary value in V1420 is subtracted from the binary value in the accumulator using the Subtract Binary instruction. The value in the accumulator is copied to V1500 - V1501 using the Out Double instruction.
230
240
250-1
260
262
�����
SUBBA aaa
Discrete Bit Flags Description SP63 On when the result of the instruction causes the value in the accumulator to be zeroSP64 On when the 16-bit subtraction instruction results in a borrowSP65 On when the 32-bit subtraction instruction results in a borrowSP70 On anytime the value in the accumulator is negative
Handheld Programmer Keystrokes
LDV1400
X1
SUBBV1420
The binary value in V1420 issubtracted from the value inthe accumulator
OUTV1500
Copy the value in the lower 16bits of the accumulator to V1500
V1500
(V1420) A0B (Hex) = 2571 (decimal)
0
1 (Accumulator) 1024 (Hex) = 4132 (decimal)
0
1
0
0
V14000 2 4
6 1 9
0 0 0 0 2 4
A 0 B
Acc. 6 1 9
The unused accumulatorbits are set to zero
STR 1
D 1 4 0 0
OUT 1 5 0 0
1 4 0
S
2
SHFT B
SHFT
ENT
SHFT L ENT
U B
ENT
ENT
SHFT
Use either OR ConstantV-memory
LD
BIN
K1024
Load the value in V1400into the lower 16 bits ofthe accumulator
-
DirectSOFT
(Accumulator) 619 (Hex) = 1561 (decimal)
Operand Data TypeRange
D2-250-1 D2-260/D2-262 A aaa aaaV-memory V All (See page 3-56) All (See page 3-57)Pointer P All V-mem (See page 3-56) All V-mem (See page 3-57)Constant K 0-FFFF 0-FFFF
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B5-104
Chapter 5: Standard RLL Instructions
Subtract Binary Double (SUBBD)Subtract Binary Double is a 32-bit instruction that subtracts the binary value (Aaaa), which is either two consecutive V-memory locations or an 8-digit (max) binary constant, from the binary value in the accumulator. The result resides in the accumulator.
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example, when X1 is on, the value in V1400 and V1401 will be loaded into the accumulator using the Load Double instruction. The binary value in V1420 and V1421 is subtracted from the binary value in the accumulator using the Subtract Binary Double instruction. The value in the accumulator is copied to V1500 and V1501 using the Out Double instruction.
�����
230
240
250-1
260
262
SUBBDA aaa
LDDV1400
X1
SUBBDV1420
The binary value in V1420 andV1421 is subtracted from thebinary value in the accumulator
OUTDV1500
Copy the value in theaccumulator to V1500and V1501
F E0 0 0 5
F F0 0 0 6
6
0
(V1421 and V1420)
0
0
E
0 0
E
6 0 0 F F (Accumulator)
V1500
0
V1400
6 F E
V1401
V1501
0 0 0 5
0 0 0 1 A 0 1
Acc.
Use either OR ConstantV-memory
LDD
BIN
K393471
Load the value in V1400and V1401 into theaccumulator
-
DirectSOFT
STR
SHFT
SHFT SHFT
SHFTOUT
ENT
ENT
ENT
ENT
1
S
L D
1 4 2
D
D 1 4
U B
0
1
0
B
5
0
D
0 0
Handheld Programmer Keystrokes
Discrete Bit Flags Description SP63 On when the result of the instruction causes the value in the accumulator to be zeroSP64 On when the 16-bit subtraction instruction results in a borrowSP65 On when the 32-bit subtraction instruction results in a borrowSP70 On anytime the value in the accumulator is negative
Operand Data Type Range D2-260/D2-262
A aaaV-memory V All (See page 3-57)Pointer P All V-mem (See page 3-57)Constant K 0-FFFFFFFF
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-105
Chapter 5: Standard RLL Instructions
Multiply Binary (MULB)The Multiply Binary instruction multiplies a 16-bit number A(aaa) by the value stored in the accumulator. The number in the accumulator can be up to 32 bits long. The source of the 16-bit operand can be a constant or a data value located in V-memory. Multiply Binary performs the multiplication operation on the full binary representation of the operands, which distinguishes it from the Multiply instruction (see page 5-94), which treats the operands as BCD numbers. Although the multiplication operation is performed on the underlying binary values, the native display format is hexadecimal. For that reason, you will need to load constants in hex.
The product of the Multiply Binary operation occupies the full 32-bit accumulator and requires an Out Double to move the product to V-memory. If the value in the accumulator occupies fewer than 32 bits, leading zeros are loaded in the left-most empty bit positions.
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example, when X1 is on, the value in V1400 will be loaded into the accumulator using the Load instruction. The binary value in V1420 is multiplied by the binary value in the accumulator using the Multiply Binary instruction. The value in the accumulator is copied to V1500 - V1501 using the Out Double instruction.
230
240
250-1
260
262
�����
MULBA aaa
Discrete Bit Flags Description SP63 On when the result of the instruction causes the value in the accumulator to be zeroSP70 On anytime the value in the accumulator is negative
Handheld Programmer Keystrokes
LDV1400
X1
MULBV1420
The binary value in V1420 ismultiplied by the binaryvalue in the accumulator
OUTDV1500
0
0
0
0
V1400A 0 1
0 0 0 A 0 1
0 2 E
The unused accumulatorbits are set to zero
2 E0 0 0 1 C
C
C
V1500
C 2 E
V1501
0 0 0 1
Acc.
STR 1
D 1 4 0 0
1 5 0 0
1 4 0M 2SHFT B
SHFT D
ENT
SHFT L ENT
U L ENT
ENT
Copy the value of the accumulatorto V1500 and V1501
Use either OR ConstantV-memory
LD
BIN
K2561
Load the value in V1400into the lower 16 bits ofthe accumulator
x
DirectSOFT
(Accumulator) A01 (Hex) = 2561 (decimal)
(V1420) 2E (Hex) = 46 (decimal)
(Accumulator) 1CC2E (Hex) = 117806 (decimal)
(V1500 - V1501 value = 117806 decimal)
OUT
Operand Data TypeRange
D2-250-1 D2-260/D2-262 A aaa aaaV-memory V All (See page 3-56) All (See page 3-57)Pointer P All V mem (See page 3-56) All V mem (See page 3-57)Constant K 0-FFFF 0-FFFF
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B5-106
Chapter 5: Standard RLL Instructions
Divide Binary (DIVB)The Divide Binary instruction divides a 16-bit number (Aaaa) into the value stored in the accumulator. The number in the accumulator can be up to 32 bits long. The source of the 16-bit divisor can be a constant or a data value located in V-memory. Divide Binary performs the division operation on the full binary representation of the operands, which distinguishes it from the Divide instruction (see page 5-97), which treats the operands as BCD numbers. Although the division operation is performed on the underlying binary values, the native display format is hexadecimal. For that reason you will need to load constants in hex.
At the completion of the division operation, the quotient resides in the accumulator and the remainder resides in the first stack location.
The quotient occupies the full 32-bit accumulator and requires an Out Double to move the quotient to V-memory. If the value in the accumulator occupies fewer than 32 bits, leading zeros are loaded in the left-most empty bit positions.
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example, when X1 is on, the value in V1400 will be loaded into the accumulator using the Load instruction. The binary value in the accumulator is divided by the binary value in V1420 using the Divide Binary instruction. The value in the accumulator is copied to V1500 using the Out Double instruction.
230
240
250-1
260
262
�����
DIVBA aaa
V1500
0 (Accumulator)F
0
0
F
(V1420)
0
V1400A 0 1
3 2 0
0 0 0 A 0 1
0 5 0
3 2 0
The unused accumulatorbits are set to zero
0 0 10 0 0 0 0
STR 1
D 1 4 0 0
OUT V 1 5 0 0
1 4 0D 2SHFT B
SHFT
ENT
SHFT L ENT
I V ENT
ENT
_..
0 0 0 0
0 0 0 0
V1501
FA01 (Hex) = 64001 (decimal)50 (Hex) = 80 (decimal)
320 (Hex) = 800 (decimal)
1 (Hex) = 1 (decimal)
(Accumulator)
Top of stack holds remainder
LDV1400
X1
DIVBV1420
The binary value in theaccumulator is divided bythe binary value in V1420
OUTV1500
Copy the value in the lower 16bits of the accumulator to V1500
Use either OR ConstantV-memory
LDD
BIN
K64001
Load the value in V1400into the lower 16 bits ofthe accumulator
DirectSOFT
Handheld Programmer Keystrokes
Operand Data TypeRange
D2-250-1 D2-260/D2-262 A aaa aaaV-memory V All (See page 3-56) All (See page 3-57)Pointer P All V mem (See page 3-56) All V mem (See page 3-57)Constant K 0-FFFF 0-FFFF
DS UsedHPP Used
Discrete Bit Flags Description SP53 On when the value of the operand is larger than the accumulator can work withSP63 On when the result of the instruction causes the value in the accumulator to be zeroSP70 On anytime the value in the accumulator is negative
DL205 User Manual, 5th Edition, Rev. B 5-107
Chapter 5: Standard RLL Instructions
Increment Binary (INCB)The Increment Binary instruction increments a binary value in a specified V-memory location by “1” each time the instruction is executed.
NOTE: The status flags are only valid until another instruction that uses the same flags is executed.
In the following example, when C5 is on, the binary value in V2000 is increased by 1.
Discrete Bit Flags Description SP63 On when the result of the instruction causes the value in the accumulator to be zero
Operand Data Type RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
A aaa aaa aaa aaaV-memory V All (See page 3-54) All (See page 3-55) All (See page 3-56) All (See page 3-57)
Pointer P - All V-memory (See page 3-55)
All V-memory (See page 3-56)
All V-memory (See page 3-57)
Handheld Programmer KeystrokesDirectSOFT
C5 INCBV2000
Increment the binary valuein V2000 by “1”
4 A 3 C
4 A 3 D
STR$
2C
5FSHFT ENT
SHFT 8I
TMRN
2C
1B
2C
0A
0A
0A ENT
V2000
V2000
DS UsedHPP Used
INCBA aaa
�����
230
240
250-1
260
262
DL205 User Manual, 5th Edition, Rev. B5-108
Chapter 5: Standard RLL Instructions
Decrement Binary (DECB)The Decrement Binary instruction decrements a binary value in a specified V-memory location by “1” each time the instruction i s executed.
NOTE: The status flags are only valid until another instruction that uses the same flag is executed.
In the following example, when C5 is on, the value in V2000 is decreased by 1.
Handheld Programmer KeystrokesDirectSOFT
C5 DECBV2000
Decrement the binary valuein V2000 by “1”
V2000
4 A 3 C?
V2000
4 A 3 B?
STR$
2C
5FSHFT ENT
SHFT 2C
3D
4E
1B
2C
0A
0A
0A ENT
CVP
3DSHFT
DS UsedHPP Used
A aaaDECB�
����
230
240
250-1
260
262
Operand Data Type RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
A aaa aaa aaa aaaV-memory V All (See page 3-54) All (See page 3-55) All (See page 3-56) All (See page 3-57)
Pointer P - All V-memory (See page 3-55)
All V-memory (See page 3-56)
All V-memory (See page 3-57)
Discrete Bit Flags Description SP63 On when the result of the instruction causes the value in the accumulator to be zero
DL205 User Manual, 5th Edition, Rev. B 5-109
Chapter 5: Standard RLL Instructions
Add Formatted (ADDF)Add Formatted is a 32-bit instruction that adds the BCD value in the accumulator with the BCD value (Aaaa), which is a range of discrete bits. The specified range (Kbbb) can be 1 to 3 2 consecutive bits. The result resides in the accumulator.
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example, when X6 is on, the value formed by discrete locations X0–X3 is loaded into the accumulator using the Load Formatted instruction. The value formed by discrete locations C0–C3 is added to the value in the accumulator using the Add Formatted instruction. The value in the lower four bits of the accumulator is copied to Y10–Y13 using the Out Formatted instruction.
�����
230
240
250-1
260
262
ADDF A aaa
K bbb
Operand Data Type Range D2-260/D2-262
A aaa bbbInputs X 0-1777 -Outputs Y 0-1777 - Control Relays C 0-3777 -Stage Bits S 0-1777 -Timer Bits T 0-377 -Counter Bits CT 0-377 -Special Relays SP 0-777 -Global I/O GX/GY 0-3777 -Constant K - 1-32
Discrete Bit Flags Description SP63 On when the result of the instruction causes the value in the accumulator to be zeroSP66 On when the 16-bit addition instruction results in a carrySP67 On when the 32-bit addition instruction results in a carrySP70 On anytime the value in the accumulator is negativeSP75 On when a BCD instruction is executed and a NON-BCD number was encountered
DirectSOFT
LDF X0K4
X6 Load the BCD value representedby discrete locations X0–X3into the accumulator
ADDF C0K4
Add the BCD value in theaccumulator with the valuerepresented by discretelocation C0–C3
OUTF Y10K4
Copy the lower 4 bits of theaccumulator to discretelocations Y10–Y13
+
0 0 0 0 0 0 0 8
(C0-C3)
(Accumulator)
3
X0X1X2X3OFFOFFOFFON
C0C1C2C3ONONOFFOFF
Y10Y11Y12Y13ONOFFOFFOFF
The unused accumulatorbits are set to zero
Acc.
Handheld Programmer Keystrokes
STR$
SHFT 3D
3D
OUTGX SHFT 5
F0
A4
E ENT
6G ENT
1B
4E
0A ENT
SHFT ANDSTL
3D
0A
4E ENT5
F
5F
0A NEXT NEXT NEXTNEXT
0 110 0 0 0 0
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B5-110
Chapter 5: Standard RLL Instructions
Subtract Formatted (SUBF)Subtract Formatted is a 32-bit instruction that subtracts the BCD value (Aaaa), which is a range of discrete bits, from the BCD value in the accumulator. The specified range (Kbbb) can be 1 to 32 consecutive bits. The result resides in the accumulator.
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example, when X6 is on, the value formed by discrete locations X0–X3 is loaded into the accumulator using the Load Formatted instruction. The value formed by discrete location C0–C3 is subtracted from the value in the accumulator using the Subtract Formatted instruction. The value in the lower four bits of the accumulator is copied to Y10–Y13 using the Out Formatted instruction.
�����
230
240
250-1
260
262
SUBF A aaaK bbb
Discrete Bit Flags Description SP63 On when the result of the instruction causes the value in the accumulator to be zeroSP64 On when the 16-bit subtraction instruction results in a borrowSP65 On when the 32-bit subtraction instruction results in a borrowSP70 On anytime the value in the accumulator is negativeSP75 On when a BCD instruction is executed and a NON-BCD number was encountered
LDF X0K4
X6
SUBF C0K4
OUTF Y10K4
Copy the lower 4 bits of theaccumulator to discretelocations Y10--Y13
0 10 0 0 0 0
_0 0 0
0
0 0 0 0 9
(C0--C3)
(Accumulator)
8
X0X1X2X3ONOFFOFFON
C0C1C2C3OFFOFFOFFON
Y10Y11Y12Y13ONOFFOFFOFF
The unused accumulatorbits are set to zero
ACC.
Handheld Programmer Keystrokes
STR$
SHFT ISGU
1B
OUTGX SHFT 5
F0
A4
E ENT
6G ENT
1B
4E
0A ENT
SHFT ANDSTL
3D
0A
4E ENT5
F
5F
RSTS NEXT NEXT NEXTNEXTSHFT
Load the BCD value representedby discrete locations X0-X3 intothe accumulator
Subtract the BCD valuerepresented by C0-C3 fromthe value in the accumulator
DirectSOFT
Operand Data Type Range D2-260/D2-262
A aaa bbbInputs X 0-1777 -Outputs Y 0-1777 - Control Relays C 0-3777 -Stage Bits S 0-1777 -Timer Bits T 0-377 -Counter Bits CT 0-377 -Special Relays SP 0-777 -Global I/O GX/GY 0-3777 -Constant K - 1-32
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-111
Chapter 5: Standard RLL Instructions
Multiply Formatted (MULF)Multiply Formatted is a 16-bit instruction that multiplies the BCD value in the accumulator by the BCD value (Aaaa) which is a range of discrete bits. The specified range (Kbbb) can be 1 to 16 consecutive bits. The result resides in the accumulator.
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example, when X6 is on, the value formed by discrete locations X0–X3 is loaded into the accumulator using the Load Formatted instruction. The value formed by discrete locations C0–C3 is multiplied by the value in the accumulator using the Multiply Formatted instruction. The value in the lower four bits of the accumulator is copied to Y10–Y13 using the Out Formatted instruction.
Discrete Bit Flags Description SP63 On when the result of the instruction causes the value in the accumulator to be zeroSP70 On anytime the value in the accumulator is negativeSP75 On when a BCD instruction is executed and a NON-BCD number was encountered
�����
230
240
250-1
260
262
MULF A aaa
K bbb
LDF X0
K4
X6 Load the value representedby discrete locations X0--X3into the accumulator
MULF C0
K4
Multiply the value in theaccumulator with the valuerepresented by discretelocations C0--C3
OUTF Y10
K4
Copy the lower 4 bits of theaccumulator to discretelocations Y10--Y13
0 60 0 0 0 0
0 0 0
0
0 0 0 0 3
(C0--C3)
(Accumulator)
2
X0X1X2X3
ONONOFFOFF
C0C1C2C3
OFFONOFFOFF
Y10Y11Y12Y13
OFFONONOFF
The unused accumulatorbits are set to zero
Acc.
Handheld Programmer Keystrokes
STR$
SHFTISG
UANDSTL
OUTGX SHFT
5F
0A
4E ENT
6G ENT
1B
4E
0A ENT
SHFTANDSTL
3D
0A
4E ENT
5F
5F
ORSTM NEXT NEXT NEXTNEXT
X
DirectSOFT
Operand Data Type Range D2-260/D2-262
A aaa bbbInputs X 0-1777 -Outputs Y 0-1777 - Control Relays C 0-3777 -Stage Bits S 0-1777 -Timer Bits T 0-377 -Counter Bits CT 0-377 -Special Relays SP 0-777 -Global I/O GX/GY 0-3777 -Constant K - 1-16
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B5-112
Chapter 5: Standard RLL Instructions
Divide Formatted (DIVF)Divide Formatted is a 16-bit instruction that divides the BCD value in the accumuator by the BCD value (Aaaa), a range of discrete bits. The specified range (Kbbb) can be 1 to 16 consecutive bits. The first part of the quotient resides in the accumulator and the remainder resides in the first stack location.
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example, when X6 is on, the value formed by discrete locations X0–X3 is loaded into the accumulator using the Load Formatted instruction. The value in the accumulator is divided by the value formed by discrete location C0–C3 using the Divide Formatted instruction. The value in the lower four bits of the accumulator is copied to Y10–Y13 using the Out Formatted instruction.
�����
230
240
250-1
260
262
DIVF A aaa
K bbb
LDF X0K4
X6 Load the value representedby discrete locations X0--X3into the accumulator
DIVF C0K4
Divide the value in theaccumulator with the valuerepresented by discretelocation C0--C3
OUTF Y10K4
Copy the lower 4 bits of theaccumulator to discretelocations Y10--Y13
0 40 0 0 0 0
0 0 0
0
0 0 0 0 8
(C0--C3)
(Accumulator)
2
X0X1X2X3OFFOFFOFFON
C0C1C2C3OFFONOFFOFF
Y10Y11Y12Y13OFFOFFONOFF
The unused accumulatorbits are set to zero
0 0 00 0 0 0 0
First stack location containsthe remainder
Acc.
Handheld Programmer Keystrokes
STR$
SHFT 8I
ANDV
OUTGX SHFT 5
F0
A4
E ENT
6G ENT
1B
4E
0A ENT
SHFT ANDSTL
3D
0A
4E ENT5
F
5F
3D NEXT NEXT NEXTNEXT
_..
DirectSOFT
DS UsedHPP Used
Operand Data Type Range D2-260/D2-262
A aaa bbbInputs X 0-1777 -Outputs Y 0-1777 - Control Relays C 0-3777 -Stage Bits S 0-1777 -Timer Bits T 0-377 -Counter Bits CT 0-377 -Special Relays SP 0-777 -Global I/O GX/GY 0-3777 -Constant K - 1-16
Discrete Bit Flags Description SP63 On when the result of the instruction causes the value in the accumulator to be zeroSP70 On anytime the value in the accumulator is negativeSP75 On when a BCD instruction is executed and a NON-BCD number was encountered
DL205 User Manual, 5th Edition, Rev. B 5-113
Chapter 5: Standard RLL Instructions
Add Top of Stack (ADDS)Add Top of Stack is a 32-bit instruction that adds the BCD value in the accumulator with the BCD value in the first level of the accumulator stack. The result resides in the accumulator. The value in the first level of the accumulator stack is removed and all stack values are moved up one level.
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example, when X1 is on, the value in V1400 and V1401 will be loaded into the accumulator using the Load Double instruction. The value in V1420 and V1421 is loaded into the accumulator using the Load Double instruction, pushing the value previously loaded in the accumulator onto the accumulator stack. The value in the first level of the accumulator stack is added with the value in the accumulator using the Add Stack instruction. The value in the accumulator is copied to V1500 and V1501 using the Out Double instruction.
�����
230
240
250-1
260
262
ADDS
Discrete Bit Flags Description SP63 On when the result of the instruction causes the value in the accumulator to be zeroSP66 On when the 16-bit addition instruction results in a carrSP67 On when the 32-bit addition instruction results in a carry.SP70 On anytime the value in the accumulator is negativ.SP75 On when a BCD instruction is executed and a NON-BCD number was encountered
LDDV1400
X1 Load the value in V1400 andV1401 into the accumulator
LDDV1420
Load the value in V1420 andV1421 into the accumulator
OUTDV1500
Copy the value in theaccumulator to V1500and V1501
X X X X X X X XLevel 1
X X X X X X X XLevel 2
X X X X X X X XLevel 3
X X X X X X X XLevel 4
X X X X X X X XLevel 5
X X X X X X X XLevel 6
X X X X X X X XLevel 7
X X X X X X X XLevel 8
0 0 3 9 5 0 2 6Level 1
X X X X X X X XLevel 2
X X X X X X X XLevel 3
X X X X X X X XLevel 4
X X X X X X X XLevel 5
X X X X X X X XLevel 6
X X X X X X X XLevel 7
X X X X X X X XLevel 8
ADDS Add the value in theaccumulator with the valuein the first level of theaccumulator stack
Acc.
V14005 0 2 6
0 0 3 9 5 0 2 6
V14010 0 3 9
Acc.
V14202 0 5 6
0 0 1 7 2 0 5 6
V14210 0 1 7
Accumulator stackafter 1st LDD
Accumulator stackafter 2nd LDD
Acc. 0 0 5 6 7 0 8 2
0 0 5 6 7 0 8 2
Handheld Programmer Keystrokes
SHFT ANDSTL
3D
STR$
SHFT 3D
3D
OUTGX SHFT 3
D1
B5
F0
A0
A ENT
1B ENT
1B
4E
0A
0A ENT
ENT
SHFT ANDSTL
3D
1B
4E
2C
0A ENT3
D
RSTS
3D
0A
V1501 V1500
DirectSOFT
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B5-114
Chapter 5: Standard RLL Instructions
Subtract Top of Stack (SUBS)Subtract Top of Stack is a 32-bit instruction that subtracts the BCD value in the first level of the accumulator stack from the BCD value in the accumulator. The result resides in the accumulator. The value in the first level of the accumulator stack is removed and all stack values are moved up one level.
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example, when X1 is on, the value in V1400 and V1401 will be loaded into the accumulator using the Load Double instruction. The value in V1420 and V1421 is loaded into the accumulator using the Load Double instruction, pushing the value previously loaded into the accumulator onto the accumulator stack. The BCD value in the first level of the accumulator stack is subtracted from the BCD value in the accumulator using the Subtract Stack instruction. The value in the accumulator is copied to V1500 and V1501 using the Out Double instruction.
�����
230
240
250-1
260
262
S UBS
LDDV1400
X1 Load the value in V1400 andV1401 into the accumulator
LDDV1420
Load the value in V1420 andV1421 into the accumulator
OUTDV1500
Copy the value in theaccumulator to V1500and V1501
X X X X X X X XLevel 1
X X X X X X X XLevel 2
X X X X X X X XLevel 3
X X X X X X X XLevel 4
X X X X X X X XLevel 5
X X X X X X X XLevel 6
X X X X X X X XLevel 7
X X X X X X X XLevel 8
0 0 1 7 2 0 5 6Level 1
X X X X X X X XLevel 2
X X X X X X X XLevel 3
X X X X X X X XLevel 4
X X X X X X X XLevel 5
X X X X X X X XLevel 6
X X X X X X X XLevel 7
X X X X X X X XLevel 8
SUBS Subtract the value in the firstlevel of the accumulatorstack from the value in theaccumulator
Acc.
V14002 0 5 6
0 0 1 7 2 0 5 6
V14010 0 1 7
Acc.
V14205 0 2 6
0 0 3 9 5 0 2 6
V14210 0 3 9
Accumulator stackafter 1st LDD
Accumulator stackafter 2nd LDD
Acc. 0 0 2 2 2 9 7 0
0 0 2 2 2 9 7 0
Handheld Programmer Keystrokes
SHFT ANDSTL
3D
STR$
SHFT ISGU
1B
OUTGX SHFT 3
D1
B5
F0
A0
A ENT
1B ENT
1B
4E
0A
0A ENT
ENT
SHFT ANDSTL
3D
1B
4E
2C
0A ENT3
D
RSTS
3D
RSTS SHFT
V1501 V1500
DirectSOFT
DS UsedHPP Used
Discrete Bit Flags Description SP63 On when the result of the instruction causes the value in the accumulator to be zeroSP64 On when the 16-bit subtraction instruction results in a borrowSP65 On when the 32-bit subtraction instruction results in a borrowSP70 On anytime the value in the accumulator is negativeSP75 On when a BCD instruction is executed and a NON-BCD number was encountered
DL205 User Manual, 5th Edition, Rev. B 5-115
Chapter 5: Standard RLL Instructions
Multiply Top of Stack (MULS)Multiply Top of Stack is a 16-bit instruction that multiplies a 4-digit BCD value in the first level of the accumulator stack by a 4-digit BCD value in the accumulator. The result resides in the accumulator. The value in the first level of the accumulator stack is removed, and all stack values are moved up one level.
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example, when X1 is on, the value in V1400 will be loaded into the accumulator using the Load instruction. The value in V1420 is loaded into the accumulator using the Load instruction, pushing the value previously loaded in the accumulator onto the accumulator stack. The BCD value in the first level of the accumulator stack is multiplied by the BCD value in the accumulator using the Multiply Stack instruction. The value in the accumulator is copied to V1500 and V1501 using the Out Double instruction.
�����
230
240
250-1
260
262
MULS
LDV1400
X1 Load the value in V1400 intothe accumulator
LDV1420
Load the value in V1420 intothe accumulator
OUTDV1500
Copy the value in theaccumulator to V1500and V1501
X X X X X X X XLevel 1
X X X X X X X XLevel 2
X X X X X X X XLevel 3
X X X X X X X XLevel 4
X X X X X X X XLevel 5
X X X X X X X XLevel 6
X X X X X X X XLevel 7
X X X X X X X XLevel 8
0 0 0 0 5 0 0 0Level 1
X X X X X X X XLevel 2
X X X X X X X XLevel 3
X X X X X X X XLevel 4
X X X X X X X XLevel 5
X X X X X X X XLevel 6
X X X X X X X XLevel 7
X X X X X X X XLevel 8
MULS Multiply the value inthe accumulator with thevalue in the first levelof the accumulator stack
Acc.
V14005 0 0 0
0 0 0 0 5 0 0 0
Acc.
V14200 2 0 0
0 0 0 0 0 2 0 0
Accumulator stackafter 1st LDD
Accumulator stackafter 2nd LDD
Acc. 0 1 0 0 0 0 0 0
0 1 0 0 0 0 0 0
V1500V1501
The unused accumulatorbits are set to zero
The unused accumulatorbits are set to zero
Handheld Programmer Keystrokes
SHFT ANDSTL
3D
STR$
SHFT ORSTM
ISGU
ANDSTL
OUTGX SHFT 3
D1
B5
F0
A0
A ENT
1B ENT
1B
4E
0A
0A ENT
ENT
SHFT ANDSTL
3D
1B
4E
2C
0A
RSTS
ENT
DirectSOFT
DS UsedHPP Used
Discrete Bit Flags Description SP63 On when the result of the instruction causes the value in the accumulator to be zeroSP70 On anytime the value in the accumulator is negativeSP75 On when a BCD instruction is executed and a NON-BCD number was encountered
DL205 User Manual, 5th Edition, Rev. B5-116
Chapter 5: Standard RLL Instructions
Divide by Top of Stack (DIVS)Divide Top of Stack is a 32-bit instruction that divides the 8-digit BCD value in the accumulator by a 4-digit BCD value in the first level of the accumulator stack. The result resides in the accumulator and the remainder resides in the first level of the accumulator stack.
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example, when X1 is on, the Load instruction loads the value in V1400 into the accumulator. The value in V1420 is loaded into the accumulator using the Load Double instruction, pushing the value previously loaded in the accumulator onto the accumulator stack. The BCD value in the accumulator is divided by the BCD value in the first level of the accumulator stack using the Divide Stack instruction. The Out Double instruction copies the value in the accumulator to V1500 and V1501.
�����
230
240
250-1
260
262
DIVS
Discrete Bit Flags Description SP53 On when the value of the operand is larger than the accumulator can work withSP63 On when the result of the instruction causes the value in the accumulator to be zeroSP70 On anytime the value in the accumulator is negative.SP75 On when a BCD instruction is executed and a NON-BCD number was encountered
LDV1400
X1 Load the value in V1400 intothe accumulator
LDDV1420
Load the value V1420 andV1421 into the accumulator
OUTDV1500
Copy the value in theaccumulator to V1500and V1501
X X X X X X X XLevel 1
X X X X X X X XLevel 2
X X X X X X X XLevel 3
X X X X X X X XLevel 4
X X X X X X X XLevel 5
X X X X X X X XLevel 6
X X X X X X X XLevel 7
X X X X X X X XLevel 8
0 0 0 0 0 0 2 0Level 1
X X X X X X X XLevel 2
X X X X X X X XLevel 3
X X X X X X X XLevel 4
X X X X X X X XLevel 5
X X X X X X X XLevel 6
X X X X X X X XLevel 7
X X X X X X X XLevel 8
DIVSDivide the value in theaccumulator by the value inthe first level of the accumulator stack
Acc.
V1400
0 0 2 0
0 0 0 0 0 0 2 0
Acc.
V14200 0 0 0
0 0 5 0 0 0 0 0
Accumulator stackafter 1st LDD
Accumulator stackafter 2nd LDD
Acc. 0 0 0 2 5 0 0 0
0 0 0 2 5 0 0 0
V1500V1501
The unused accumulatorbits are set to zero
Handheld Programmer Keystrokes
SHFT ANDSTL
3D
STR$
SHFT 3D
8I
ANDV
OUTGX SHFT 3
D1
B5
F0
A0
A ENT
1B ENT
1B
4E
0A
0A ENT
ENT
SHFT ANDSTL
3D
1B
4E
2C
0A
RSTS
ENT3D
V14210 0 5 0
0 0 0 0 0 0 0 0Level 1
X X X X X X X XLevel 2
X X X X X X X XLevel 3
X X X X X X X XLevel 4
X X X X X X X XLevel 5
X X X X X X X XLevel 6
X X X X X X X XLevel 7
X X X X X X X XLevel 8
The remainder resides in thefirst stack location
DirectSOFT
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-117
Chapter 5: Standard RLL Instructions
Add Binary Top of Stack (ADDBS)Add Binary Top of Stack instruction is a 32-bit instruction that adds the binary value in the accumulator with the binary value in the first level of the accumulator stack. The result resides in the accumulator. The value in the first level of the accumulator stack is removed, and all stack values are moved up one level.
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example, when X1 is on, the value in V1400 and V1401 will be loaded into the accumulator using the Load Double instruction. The value in V1420 and V1421 is loaded into the accumulator using the Load Double instruction, pushing the value previously loaded in the accumulator onto the accumulator stack. The binary value in the first level of the accumulator stack is added with the binary value in the accumulator using the Add Stack instruction. The value in the accumulator is copied to V1500 and V1501 using the Out Double instruction.
�����
230
240
250-1
260
262
ADDBS
Discrete Bit Flags Description SP63 On when the result of the instruction causes the value in the accumulator to be zeroSP66 On when the 16-bit addition instruction results in a carrySP67 On when the 32-bit addition instruction results in a carrySP70 On anytime the value in the accumulator is negativeSP73 On when a signed addition or subtraction results in a incorrect sign bit
LDDV1400
X1 Load the value in V1400 andV1401 into the accumulator
LDDV1420
Load the value in V1420 andV1421 into the accumulator
OUTDV1500
Copy the value in theaccumulator to V1500and V1501
X X X X X X X XLevel 1
X X X X X X X XLevel 2
X X X X X X X XLevel 3
X X X X X X X XLevel 4
X X X X X X X XLevel 5
X X X X X X X XLevel 6
X X X X X X X XLevel 7
X X X X X X X XLevel 8
0 0 3 A 5 0 C 6Level 1
X X X X X X X XLevel 2
X X X X X X X XLevel 3
X X X X X X X XLevel 4
X X X X X X X XLevel 5
X X X X X X X XLevel 6
X X X X X X X XLevel 7
X X X X X X X XLevel 8
ADDBS Add the binary value in theaccumulator with the binaryvalue in the first level of theaccumulator stack
Acc.
V14005 0 C 6
0 0 3 A 5 0 C 6
V14010 0 3 A
Acc.
V1420B 0 5 F
0 0 1 7 B 0 5 F
V14210 0 1 7
Accumulator stackafter 1st LDD
Accumulator stackafter 2nd LDD
Acc. 0 0 5 2 0 1 2 5
0 0 5 2 0 1 2 5
Handheld Programmer Keystrokes
SHFT ANDSTL
3D
STR$
SHFT 3D
3D
OUTGX SHFT 3
D1
B5
F0
A0
A ENT
1B ENT
1B
4E
0A
0A ENT
ENT
SHFT ANDSTL
3D
1B
4E
2C
0A ENT3
D
1B
RSTS
3D
0A
DirectSOFT
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B5-118
Chapter 5: Standard RLL Instructions
Subtract Binary Top of Stack (SUBBS)Subtract Binary Top of Stack is a 32-bit instruction that subtracts the binary value in the first level of the accumulator stack from the binary value in the accumulator. The result resides in the accumulator. The value in the first level of the accumulator stack is removed, and all stack locations are moved up one level.
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example, when X1 is on, the value in V1400 and V1401 will be loaded into the accumulator using the Load Double instruction. The value in V1420 and V1421 is loaded into the accumulator using the Load Double instruction, pushing the value previously loaded in the accumulator onto the accumulator stack. The binary value in the first level of the accumulator stack is subtracted from the binary value in the accumulator using the Subtract Stack instruction. The value in the accumulator is copied to V1500 and V1501 using the Out Double instruction.
�����
230
240
250-1
260
262
S UBBS
Discrete Bit Flags Description SP63 On when the result of the instruction causes the value in the accumulator to be zeroSP64 On when the 16-bit subtraction instruction results in a borrowSP65 On when the 32-bit subtraction instruction results in a borrowSP70 On anytime the value in the accumulator is negative
LDDV1400
X1 Load the value in V1400 andV1401 into the accumulator
LDDV1420
Load the value in V1420 andV1421 into the accumulator
OUTDV1500
Copy the value in theaccumulator to V1500and V1501
X X X X X X X XLevel 1
X X X X X X X XLevel 2
X X X X X X X XLevel 3
X X X X X X X XLevel 4
X X X X X X X XLevel 5
X X X X X X X XLevel 6
X X X X X X X XLevel 7
X X X X X X X XLevel 8
0 0 1 A 2 0 5 BLevel 1
X X X X X X X XLevel 2
X X X X X X X XLevel 3
X X X X X X X XLevel 4
X X X X X X X XLevel 5
X X X X X X X XLevel 6
X X X X X X X XLevel 7
X X X X X X X XLevel 8
SUBBS Subtract the binary value inthe first level of theaccumulator stack from thebinary value in theaccumulator
Acc.
V14002 0 5 B
0 0 1 A 2 0 5 B
V14010 0 1 A
Acc.
V14205 0 C 6
0 0 3 A 5 0 C 6
V14210 0 3 A
Accumulator stackafter 1st LDD
Accumulator stackafter 2nd LDD
Acc. 0 0 2 0 3 0 6 B
0 0 2 0 3 0 6 B
Handheld Programmer Keystrokes
SHFT ANDSTL
3D
STR$
SHFT ISGU
1B
OUTGX SHFT 3
D1
B5
F0
A0
A ENT
1B ENT
1B
4E
0A
0A ENT
ENT
SHFT ANDSTL
3D
1B
4E
2C
0A ENT3
D
1B
RSTS
3D
RSTS SHFT
V1501 V1500
DirectSOFT
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-119
Chapter 5: Standard RLL Instructions
Multiply Binary Top of Stack (MULBS)Multiply Binary Top of Stack is a 16-bit instruction that multiplies the 16-bit binary value in the first level of the accumulator stack by the 16-bit binary value in the accumulator. The result resides in the accumulator and can be 32 bits (8 digits maximum). The value in the first level of the accumulator stack is removed, and all stack locations are moved up one level.
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example, when X1 is on, the Load instruction moves the value in V1400 into the accumulator. The value in V1420 is loaded into the accumulator using the Load instruction, pushing the value previously loaded in the accumulator onto the stack. The binary value in the accumulator stack’s first level is multiplied by the binary value in the accumulator using the Multiply Binary Stack instruction. The Out Double instruction copies the value in the accumulator to V1500 and V1501.
�����
230
240
250-1
260
262
MULBS
Discrete Bit Flags Description SP63 On when the result of the instruction causes the value in the accumulator to be zeroSP70 On anytime the value in the accumulator is negative
LDV1400
X1 Load the value in V1400 intothe accumulator
LDV1420
Load the value in V1420 intothe accumulator
OUTDV1500
Copy the value in theaccumulator to V1500and V1501
X X X X X X X XLevel 1
X X X X X X X XLevel 2
X X X X X X X XLevel 3
X X X X X X X XLevel 4
X X X X X X X XLevel 5
X X X X X X X XLevel 6
X X X X X X X XLevel 7
X X X X X X X XLevel 8
0 0 0 0 C 3 5 0Level 1
X X X X X X X XLevel 2
X X X X X X X XLevel 3
X X X X X X X XLevel 4
X X X X X X X XLevel 5
X X X X X X X XLevel 6
X X X X X X X XLevel 7
X X X X X X X XLevel 8
MULBS Multiply the binary value inthe accumulator with thebinary value in the first levelof the accumulator stack
Acc.
V1400C 3 5 0
0 0 0 0 C 3 5 0
Acc.
V14200 0 1 4
0 0 0 0 0 0 1 4
Accumulator stackafter 1st LDD
Accumulator stackafter 2nd LDD
Acc. 0 0 0 F 4 2 4 0
0 0 0 F 4 2 4 0
V1500V1501
The unused accumulatorbits are set to zero
The unused accumulatorbits are set to zero
Handheld Programmer Keystrokes
SHFT ANDSTL
3D
STR$
SHFT ORSTM
ISGU
ANDSTL
OUTGX SHFT 3
D1
B5
F0
A0
A ENT
1B ENT
1B
4E
0A
0A ENT
ENT
SHFT ANDSTL
3D
1B
4E
2C
0A
1B
RSTS
ENT
DirectSOFT
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B5-120
Chapter 5: Standard RLL Instructions
Divide Binary by Top of Stack (DIVBS)Divide Binary Top of Stack is a 32-bit instruction that divides the 32-bit binary value in the accumulator by the 16-bit binary value in the first level of the accumulator stack. The result resides in the accumulator. and the remainder resides in the first level of the accumulator stack.
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example, when X1 is on, the value in V1400 will be loaded into the accumulator using the Load instruction. The value in V1420 and V1421 is loaded into the accumulator using the Load Double instruction, pushing the value previously loaded in the accumulator onto the accumulator stack. The binary value in the accumulator is divided by the binary value in the first level of the accumulator stack using the Divide Binary Stack instruction. The value in the accumulator is copied to V1500 and V1501 using the Out Double instruction.
�����
230
240
250-1
260
262
DIVBS
LDV1400
X1 Load the value in V1400 intothe accumulator
LDDV1420
Load the value in V1420 andV1421 into the accumulator
OUTDV1500
Copy the value in theaccumulator to V1500and V1501
X X X X X X X XLevel 1
X X X X X X X XLevel 2
X X X X X X X XLevel 3
X X X X X X X XLevel 4
X X X X X X X XLevel 5
X X X X X X X XLevel 6
X X X X X X X XLevel 7
X X X X X X X XLevel 8
0 0 0 0 0 0 1 4Level 1
X X X X X X X XLevel 2
X X X X X X X XLevel 3
X X X X X X X XLevel 4
X X X X X X X XLevel 5
X X X X X X X XLevel 6
X X X X X X X XLevel 7
X X X X X X X XLevel 8
DIVBS Divide the binary value inthe accumulator by thebinary value in the first levelof the accumulator stack
Acc.
V14000 0 1 4
0 0 0 0 0 0 1 4
Acc.
V1420C 3 5 0
0 0 0 0 C 3 5 0
V14210 0 0 0
Accumulator stackafter 1st LDD
Accumulator stackafter 2nd LDD
Acc. 0 0 0 0 0 9 C 4
0 0 0 0 0 9 C 4
V1500V1501
The unused accumulatorbits are set to zero
0 0 0 0 0 0 0 0Level 1
X X X X X X X XLevel 2
X X X X X X X XLevel 3
X X X X X X X XLevel 4
X X X X X X X XLevel 5
X X X X X X X XLevel 6
X X X X X X X XLevel 7
X X X X X X X XLevel 8
The remainder resides in thefirst stack location
Handheld Programmer Keystrokes
SHFT ANDSTL
3D
STR$
SHFT 3D
8I
ANDV
OUTGX SHFT 3
D1
B5
F0
A0
A ENT
1B ENT
1B
4E
0A
0A ENT
ENT
SHFT ANDSTL
3D
1B
4E
2C
0A ENT3
D
1B
RSTS
DirectSOFT
DS UsedHPP Used
Discrete Bit Flags Description SP53 On when the value of the operand is larger than the accumulator can work withSP63 On when the result of the instruction causes the value in the accumulator to be zeroSP70 On anytime the value in the accumulator is negative
DL205 User Manual, 5th Edition, Rev. B 5-121
Chapter 5: Standard RLL Instructions
Transcendental Functions (D2-260 and D2-262 only)The D2-260 and D2-262 CPUs feature special numerical functions to complement the real number capability. The transcendental functions include the trigonometric sine, cosine, and tangent, and also their inverses (arc sine, arc cosine, and arc tangent). The square root function is also grouped with these other functions.
The transcendental math instructions operate on a real number in the accumulator (it cannot be BCD or binary). The real number result resides in the accumulator. The square root function operates on the full range of positive real numbers. The sine, cosine and tangent functions require numbers expressed in radians. You can work with angles expressed in degrees by first converting them to radians with the Radian (RADR) instruction, then performing the trig function. All transcendental functions utilize the following flag bits.
Sine Real (SINR)The Sine Real instruction takes the sine of the real number stored in the accumulator. The result resides in the accumulator. Both the original number and the result are in IEEE 32-bit format.
Cosine Real (COSR)The Cosine Real instruction takes the cosine of the real number stored in the accumulator. The result resides in the accumulator. Both the original number and the result are in IEEE 32-bit format.
Tangent Real (TANR)The Tangent Real instruction takes the tangent of the real number stored in the accumulator. The result resides in the accumulator. Both the original number and the result are in IEEE 32-bit format.
Arc Sine Real (ASINR)The Arc Sine Real instruction takes the inverse sine of the real number stored in the accumulator. The result resides in the accumulator. Both the original number and the result are in IEEE 32-bit format.
Discrete Bit Flags Description SP63 On when the result of the instruction causes the value in the accumulator to be zeroSP70 On anytime the value in the accumulator is negativeSP72 On anytime the value in the accumulator is a valid floating point numberSP73 On when a signed addition or subtraction results in a incorrect sign bitSP75 On when a real number instruction is executed and a non-real number was encountered
Math Function Range of Argument SP53 On when the value of the operand is larger than the accumulator can work with
SINR
TANR
Standard R
LLInstructions
COSR
ASINR
DS UsedHPP N/A
�����
230
240
250-1
260
262
DL205 User Manual, 5th Edition, Rev. B5-122
Chapter 5: Standard RLL Instructions
Arc Cosine Real (ACOSR)The Arc Cosine Real instruction takes the inverse cosine of the real number stored in the accumulator. The result resides in the accumulator. Both the original number and the result are in IEEE 32-bit format.
Arc Tangent Real (ATANR)The Arc Tangent Real instruction takes the inverse tangent of the real number stored in the accumulator. The result resides in the accumulator. Both the original number and the result are in IEEE 32-bit format.
Square Root Real (SQRTR)The Square Root Real instruction takes the square root of the real number stored in the accumulator. The result resides in the accumulator. Both the original number and the result are in IEEE 32-bit format.
NOTE: The square root function can be useful in several situations. However, if you are trying to do the square-root extract function for an orifice flow meter measurement as the PV to a PID loop, note that the PID loop already has the square-root extract function built in.
The following example takes the sine of 45 degrees. Since these transcendental functions operate only on real numbers, we do a LDR (Load Real) 45. The trig functions operate only in radians, so we must convert the degrees to radians by using the RADR command. After using the SINR (Sine Real) instruction, we use an OUTD (Out Double) instruction to move the result from the accumulator to V-memory. The result is 32-bits wide, requiring the Out Double to move it.
NOTE: The current HPP does not support real number entry with automatic conversion to the 32-bit IEEE format. You must use DirectSOFT for entering real numbers, using the LDR (Load Real) instruction.
ACOSR
ATANR
SQRTR
LDRR45
X1Load the real number 45into the accumulator.
RADR Convert the degrees intoradians, leaving the resultin the accumulator.
OUTDV2000
Copy the valus in theaccumulator to V2000and V2001.
45.000000
0.7853981
SINR Take the sine of the numberin the accumulator, whichis in radians.
0.7071067
0.7071067
DirectSOFTAccumulator contents(viewed as real number)
DS UsedHPP N/A
DL205 User Manual, 5th Edition, Rev. B 5-123
Chapter 5: Standard RLL Instructions
Bit Operation InstructionsSum (SUM)
The Sum instruction counts the number of bits that are set to “1” in the accumulator. The HEX result resides in the accumulator.
In the following example, when X1 is on, the value formed by discrete locations X10–X17 is loaded into the accumulator using the Load Formatted instruction. The number of bits in the accumulator set to “1” is counted using the Sum instruction. The value in the accumulator is copied to V1500 using the Out instruction.
230
240
250-1
260
262
�����
SUM
DirectSOFT
LDF X10K8
X1
Load the value represented bydiscrete locations X10–X17into the accumulator
SUM
Sum the number of bits inthe accumulator set to “1”
OUTV1500
Copy the value in the lower16 bits of the accumulatorto V1500
X10X11X12X13ONONOFFON
X14X15X16X17OFFOFFONON
0 0 0 0 0 0 0 0 1 1 0 0 1 0 1 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
V1500
Acc.
0 0 0 5
0 0 0 0 0 0 0 5
The unused accumulatorbits are set to zero
STR$ ENT
SHFT ANDSTL
3D
5F
SHFT RSTS
ISGU
ORSTM ENT
1B
1B
0A
8I ENT
SHFT
OUTGX PREV 1
B5
F0
A0
A ENTPREV PREV
Handheld Programmer Keystrokes
Math Function Range of Argument SP63 On when the result of the instruction causes the value in the accumulator to be zero
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B5-124
Chapter 5: Standard RLL Instructions
Shift Left (SHFL)Shift Left is a 32-bit instruction that shifts the bits in the accumulator a specified number (Aaaa) of places to the left. The vacant positions are filled with zeros, and the bits shifted out of the accumulator are lost.
In the following example, when X1 is on, the value in V2000 and V2001 will be loaded into the accumulator using the Load Double instruction. The bit pattern in the accumulator is shifted 10 bits to the left using the Shift Left instruction. The value in the accumulator is copied to V2010 and V2011 using the Out Double instruction.
SHFLA aaa
Sta
ndar
d R
LLIn
stru
ctio
ns
ENT
Handheld Programmer Keystrokes
Direct SOFT
LDD
V2000
X1
Load the value in V2000 andV2001 into the accumulator
SHFL
K10
The bit pattern in theaccumulator is shifted 10 bitpositions to the left
OUTD
V2010
Copy the value in theaccumulator to V2010 andV2011
0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 1
V2010
0 0 0 0 0 0 00 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
4 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
0 1 1 0 0 1 1 1 0 0 0 0 0 1 0 1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
Acc.
V2011
C1 4
6 7 0 5 3 1 0 1
Shifted out of the accumulator
V2000V2001
STR$
SHFTANDSTL
3D
3D
SHFTRST
S7
H5
FANDSTL
OUTGX SHFT
3D
1B ENT
2C
0A
0A
0A ENT
2C
0A
1B
0A ENT
SHFT
0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 10 0 0 1 0 1 000
004
0AB
1
DS UsedHPP Used
�����
230
240
250-1
260
262
Operand Data Type RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
A aaa aaa aaa aaaV-memory V All (See page 3-54) All (See page 3-55) All (See page 3-56) All (See page 3-57)Constant K 1-32 1-32 1-32 1-32
DL205 User Manual, 5th Edition, Rev. B 5-125
Chapter 5: Standard RLL Instructions
Shift Right (SHFR)Shift Right is a 32-bit instruction that shifts the bits in the accumulator a specified number (Aaaa) of places to the right. The vacant positions are filled with zeros, and the bits shifted out of the accumulator are lost.
In the following example, when X1 is on, the value in V2000 and V2001 will be loaded into the accumulator using the Load Double instruction. The bit pattern in the accumulator is shifted 10 bits to the right using the Shift Right instruction. The value in the accumulator is copied to V2010 and V2011 using the Out Double instruction.
SHFRA aaa
Standard R
LLInstructions
Handheld Programmer Keystrokes
Direct SOFT
LDD
V2000
X1
Load the value in V2000 andV2001 into the accumulator
SHFR
K10
The bit pattern in theaccumulator is shifted 10 bitpositions to the right
OUTD
V2010
Copy the value in theaccumulator to V2010 andV2011
0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 1
V2010
0 1 0 0 1 1 0 00 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
C 1 4
0 0 0 0 11 00 11 1 0 0 0 0 0 1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
0 1 1 0 0 1 1 1 0 0 0 0 0 1 0 1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
Acc.
V2011
0 0 9 C
Constant 6 7 0 5 3 1 0 1
Shifted out of the accumulator
V2001 V2000
STR$
SHFTANDSTL
3D
3D
SHFTRST
S7
H5
F ENT
OUTGX SHFT
3D
ORNRSHFT
1B ENT
2C
0A
0A
0A ENT
2C
0A
1B
0A ENT
0 0 0 0 0 0
1
0
0A
1B
DS UsedHPP Used
�����
230
240
250-1
260
262
Operand Data Type RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
A aaa aaa aaa aaaV-memory V All (See page 3-54) All (See page 3-55) All (See page 3-56) All (See page 3-57)Constant K 1-32 1-32 1-32 1-32
DL205 User Manual, 5th Edition, Rev. B5-126
Chapter 5: Standard RLL Instructions
Rotate Left (ROTL)Rotate Left is a 32-bit instruction that rotates the bits in the accumulator a specified number (Aaaa) of places to the left.
In the following example, when X1 is on, the value in V1400 and V1401 will be loaded into the accumulator using the Load Double instruction. The bit pattern in the accumulator is rotated 2 bit positions to the left using the Rotate Left instruction. The value in the accumulator is copied to V1500 and V1501 using the Out Double instruction.
ROTLA aaa
DirectSOFT
Handheld Programmer Keystrokes
STR$
SHFT ANDSTL
3D
3D
SHFT ORNR
MLRT
ANDSTL ENT
OUTGX SHFT 3
D
1B ENT
INST#O
ENT
1B
4E
0A
0A ENT
2C
1B
5F
0A
0A
X1 LDDV1400
ROTLK2
OUTDV1500
Load the value in V1400 andV1401 into the accumulator
The bit pattern in theaccumulator is rotated 2bit positions to the left
Copy the value in theaccumulator to V1500and V1501
17
0000000000 1 11 1 1 1
161819202122232425262728293031
9 C 1 4
V1501
Acc.
Acc.
1
1000000001 0 01 0 1 1
023456789101112131415
C 4 0 5
V1500
1000001111 0 00 0 1 1 1000001010 0 00 1 0 0
17 161819202122232425262728293031 1 023456789101112131415
6 7 0 5 3 1 0 1
V1401 V1400
230
240
250-1
260
262
�����
DS UsedHPP Used
Operand Data Type RangeD2-250-1 D2-260/D2-262
A aaa aaaV-memory V All (See page 3-56) All (See page 3-57)Constant K 1-32 1-32
DL205 User Manual, 5th Edition, Rev. B 5-127
Chapter 5: Standard RLL Instructions
Rotate Right (ROTR)Rotate Right is a 32-bit instruction that rotates the bits in the accumulator a specified number (Aaaa) of places to the right.
In the following example, when X1 is on, the value in V1400 and V1401 will be loaded into the accumulator using the Load Double instruction. The bit pattern in the accumulator is rotated 2 bit positions to the right using the Rotate Right instruction. The value in the accumulator is copied to V1500 and V1501 using the Out Double instruction.
ROTRA aaa
Handheld Programmer Keystrokes
DirectSOFT
LDDV1400
X1
Load the value in V1400 andV1401 into the accumulator
ROTRK2
The bit pattern in theaccumulator is rotated 2bit positions to the right
OUTDV1500
Copy the value in theaccumulator to V1500and V1501
0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 1
V1500
0 1 0 0 1 1 0 0 0 1 0 0 0 0 0 00 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
4 C 4 0
0 1 0 1 1 0 0 1 1 1 0 0 0 0 0 1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
0 1 1 0 0 1 1 1 0 0 0 0 0 1 0 1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
Acc.
V1501
5 9 C 1
6 7 0 5 3 1 0 1
V1400V1401
STR$
SHFT ANDSTL
3D
3D
SHFT ORNR
MLRT
ORNR ENT
OUTGX SHFT 3
D
1B ENT
INST#O
ENT
1B
4E
0A
0A ENT
2C
1B
5F
0A
0A
230
240
250-1
260
262
�����
DS UsedHPP Used
Operand Data Type RangeD2-250-1 D2-260/D2-262
A aaa aaaV-memory V All (See page 3-56) All (See page 3-57)Constant K 1-32 1-32
DL205 User Manual, 5th Edition, Rev. B5-128
Chapter 5: Standard RLL Instructions
Encode (ENCO)The Encode instruction encodes the bit position in the accumulator having a value of 1, and returns the appropriate binary representation. If the most significant bit is set to 1 (Bit 31), the Encode instruction would place the value HEX 1F (decimal 31) in the accumulator. If the value to be encoded is 0000 or 0001, the instruction will place a zero in the accumulator. If the value to be encoded has more than one bit position set to a “1”, the least significant “1” will be encoded and SP53 will be set on.
NOTE: The status flags are only valid until another instruction that uses the same flags is executed.
In the following example, when X1 is on, The value in V2000 is loaded into the accumulator using the Load instruction. The bit position set to a “1” in the accumulator is encoded to the corresponding 5-bit binary value using the Encode instruction. The value in the lower 16 bits of the accumulator is copied to V2010 using the Out instruction.
ENCO
Discrete Bit Flags Description SP53 On when the value of the operand is larger than the accumulator can work with
Handheld Programmer Keystrokes
DirectSOFT
LDV2000
X1
Load the value in V2000 intothe lower 16 bits of theaccumulator
ENCO
Encode the bit position setto “1” in the accumulator to a5 bit binary value
0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
V20001 0 0 0
Bit postion 12 isconverted to binary
Copy the value in the lower 16 bitsof the accumulator to V2010
OUTV2010
0 0 0 C
Binary valuefor 12.
STR$
1B ENT
SHFT
OUTGX SHFT AND
V2
C0
A1
B0
A ENT
4E
TMRN
2C
INST#O ENT
SHFT ANDSTL
3D
2C
0A
0A
0A ENT
V2010
DS UsedHPP Used
�����
230
240
250-1
260
262
DL205 User Manual, 5th Edition, Rev. B 5-129
Chapter 5: Standard RLL Instructions
Decode (DECO)The Decode instruction decodes a 5-bit binary value of 0 to 31 (0 to 1F HEX) in the accumulator by setting the appropriate bit position to a 1. If the accumulator contains the value F (HEX), bit 15 will be set in the accumulator. If the value to be decoded is greater than 31, the number is divided by 32 until the value is less than 32 and then the value is decoded.
In the following example, when X1 is on, the value formed by discrete locations X10–X14 is loaded into the accumulator using the Load Formatted instruction. The 5-bit binary pattern in the accumulator is decoded by setting the corresponding bit position to a “1” using the Decode instruction.
DECO
Handheld Programmer Keystrokes
DirectSOFT
LDF X10K5
X1
Load the value inrepresented by discretelocations X10–X14 into theaccumulator
DECO
Decode the five bit binarypattern in the accumulatorand set the correspondingbit position to a “1”
OFF
0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
The binary vlaue is converted tobit position 11.
STR$ ENT
SHFT ANDSTL
3D
5F
1B
1B
0A ENT5
F
SHFT 2C
INST#O ENT3
D4
E
ON OFF ON ON X14 X13 X12 X11 X10
DS UsedHPP Used
�����
230
240
250-1
260
262
DL205 User Manual, 5th Edition, Rev. B5-130
Chapter 5: Standard RLL Instructions
Number Conversion Instructions (Accumulator)Binary (BIN)
The Binary instruction converts a BCD value in the accumulator to the equivalent binary value. The result resides in the accumulator.
In the following example, when X1 is on, the value in V2000 and V2001 is loaded into the accumulator using the Load Double instruction. The BCD value in the accumulator is converted to the binary (HEX) equivalent using the BIN instruction. The binary value in the accumulator is copied to V2010 and V2011 using the Out Double instruction. (The Handheld Programmer will display the binary value in V2010 and V2011 as a HEX value.)
BIN
STR$
0A
OUTGX SHFT 3
D2
C0
A1
B ENT
0 0 0 0 6 F 7 1
V2010V2011
Handheld Programmer Keystrokes
LDDV2000
X1
BIN
1 0 0 0 0 1 0 1 0 0 1 0 1 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
8 4 2 1 8 4 2 1 8 4 2 1 8 4 2 18 4 2 1 8 4 2 1 8 4 2 1 8 4 2 1
Acc.
0 0 0 2 8 5 2 9
V2000V2001
0 1 1 0 1 1 1 1 0 1 1 1 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
124816
32
64
128
256
512
1024
2048
4096
8192
16384
32768
65536
131072
262144
524288
1048576
2097152
4194304
8388608
16777216
33554432
67108864
134217728
268435456
536870912
1073741824
21474483648
OUTDV2010
28529 = 16384 + 8192 + 2048 + 1024 + 512 + 256 + 64 + 32 + 16 + 1
1B ENT
SHFT ANDSTL
3D
3D
2C
0A
0A
0A ENT
SHFT 1B
8I
TMRN ENT
Copy the binary data in theaccumulator to V2010 and V2011
Convert the BCD value in the accumulator to the binary equivalent value
Load the value in V2000 andV2001 into the accumulator
BCD Value
Binary Equivalent Value
The Binary (HEX)value copied toV2010
DirectSOFT
DS UsedHPP Used
�����
230
240
250-1
260
262
DL205 User Manual, 5th Edition, Rev. B 5-131
Chapter 5: Standard RLL Instructions
Binary Coded Decimal (BCD)The Binary Coded Decimal instruction converts a binary value in the accumulator to the equivalent BCD value. The result resides in the accumulator.
In the following example, when X1 is on, the binary (HEX) value in V2000 and V2001 is loaded into the accumulator using the Load Double instruction. The binary value in the accumulator is converted to the BCD equivalent value using the BCD instruction. The BCD value in the accumulator is copied to V2010 and V2011 using the Out Double instruction.
BCD
3D
Handheld Programmer Keystrokes
LDDV2000
X1
Load the value in V2000 andV2001 into the accumulator
BCD
Convert the binary value inthe accumulator to the BCDequivalent value
0 1 1 0 1 1 1 1 0 1 1 1 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
0 0 0 0 6 F 7 1
V2000V2001
BCD Equivalent Value
Binary Value
1 0 0 0 0 1 0 1 0 0 1 0 1 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0Acc.
124816
32
64
128
256
512
1024
2048
4096
8192
16384
32768
65536
131072
262144
524288
1048576
2097152
4194304
8388608
16777216
33554432
67108864
134217728
268435456
536870912
1073741824
21474483648
Copy the BCD value in theaccumulator to V2010 and V2011
OUTDV2010
The BCD valuecopied toV2010 and V2011
0 0 0 2 8 5 2 9
V2010V2011
8 4 2 1 8 4 2 1 8 4 2 1 8 4 2 18 4 2 1 8 4 2 1 8 4 2 1 8 4 2 1
16384 + 8192 + 2048 + 1024 + 512 + 256 + 64 + 32 + 16 + 1 = 28529
STR$
1B ENT
SHFT ANDSTL
3D
3D
2C
0A
0A
0A ENT
SHFT 1B ENT
OUTGX SHFT
2C
0A
1B
0A ENT
2C
3D
DirectSOFT
DS UsedHPP Used
�����
230
240
250-1
260
262
DL205 User Manual, 5th Edition, Rev. B5-132
Chapter 5: Standard RLL Instructions
Invert (INV)The Invert instruction inverts or takes the one’s complement of the 32-bit value in the accumulator. The result resides in the accumulator.
In the following example, when X1 is on, the value in V2000 and V2001 will be loaded into the accumulator using the Load Double instruction. The value in the accumulator is inverted using the Invert instruction. The value in the accumulator is copied to V2010 and V2011 using the Out Double instruction.
INV
Handheld Programmer Keystrokes
DirectSOFT
LDDV2000
X1
Load the value in V2000 andV2001 into the accumulator
INV
Invert the binary bit patternin the accumulator
OUTDV2010
Copy the value in theaccumulator to V2010 andV2011
0 0 0 0 0 0 1 0 0 1 0 1 0 0 0 00 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
0 4 0 5 0 2 5 0 0 2 5 0
V2000V2001
V2010V2011
1 1 1 1 1 1 0 1 1 0 1 0 1 1 1 11 1 1 1 1 0 1 1 1 1 1 1 1 0 1 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
F B F A F D A F
STR$
SHFT ANDSTL
3D
3D
SHFT ENT
OUTGX SHFT 3
D
8I
TMRN
ANDV
1B ENT
2C
0A
0A
0A ENT
2C
0A
1B
0A ENT
DS UsedHPP Used
�����
230
240
250-1
260
262
DL205 User Manual, 5th Edition, Rev. B 5-133
Chapter 5: Standard RLL Instructions
Ten’s Complement (BCDCPL)The Ten’s Complement instruction takes the 10’s complement (BCD) of the 8-digit accumulator. The result resides in the accumulator. The calculation for this instruction is :
In the following example when X1 is on, the value in V2000 and V2001 is loaded into the accumulator. The 10’s complement is taken for the 8-digit accumulator using the Ten’s Complement instruction. The value in the accumulator is copied to V2010 and V2011 using the Out Double instruction.
BCDCPL
3D
Handheld Programmer Keystrokes
DirectSOFT
LDDV2000
X1
Load the value in V2000 andV2001 into the accumulator
BCDCPL
Takes a 10’s complement ofthe value in the accumulator
OUTDV2010
Copy the value in theaccumulator to V2010 andV2011
Acc.
V20000 0 8 7
0 0 0 0 0 0 8 7
V20010 0 0 0
V2010
Acc.
9 9 1 3
9 9 9 9 9 9 1 3
V2011
9 9 9 9
STR$
1B ENT
SHFT ANDSTL
3D
3D
2C
0A
0A
0A ENT
SHFT ENT
OUTGX SHFT 2
C0
A1
B0
A ENT
1B
2C
3D
2C
CVP
ANDSTL
100000000 — accumulator value 10’s complement value
DS UsedHPP Used
�����
230
240
250-1
260
262
DL205 User Manual, 5th Edition, Rev. B5-134
Chapter 5: Standard RLL Instructions
Binary to Real Conversion (BTOR)The Binary-to-Real instruction converts a binary value in the accumulator to its equivalent real number (floating point) format. The result resides in the accumulator. Both the binary and the real number may use all 32 bits of the accumulator.
NOTE: This instruction only works with unsigned binary, or decimal values. It will not work with signed decimal values.
In the following example, when X1 is on, the value in V1400 and V1401 is loaded into the accumulator using the Load Double instruction. The BTOR instruction converts the binary value in the accumulator the equivalent real number format. The binary weight of the MSB is converted to the real number exponent by adding it to 127 (decimal). Then the remaining bits are copied to the mantissa as shown. The value in the accumulator is copied to V1500 and V1501 using the Out Double instruction. The Handheld Programmer would display the binary value in V1500 and V1501 as a HEX value.
BTOR
4 8 A E 4 8 2 0
V1500V1501
LDDV1400
X1
Load the value in V1400 andV1401 into the accumulator
BTOR
Convert the binary value inthe accumulator to the realnumber equivalent format
0 1 1 1 0 0 1 0 0 0 1 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1
8 4 2 1 8 4 2 1 8 4 2 1 8 4 2 18 4 2 1 8 4 2 1 8 4 2 1 8 4 2 1
Acc.
0 0 0 5 7 2 4 1
V1400V1401
Binary Value
Copy the real value in theaccumulator to V1500 and V1501
OUTDV1500
The real number (HEX) valuecopied to V1500
0 0 1 0 1 0 0 0 0 0 1 0 0 0 0 00 1 0 0 1 0 0 0 1 0 1 0 1 1 1 0Acc.
Real Number Format
Mantissa (23 bits)Exponent (8 bits)Sign Bit
2 (exp 18)127 + 18 = 145
145 = 128 + 16 + 1
STR$
SHFT ANDSTL
3D
3D
SHFT 1B
MLRT
ORNR ENT
OUTGX SHFT 3
D
1B ENT
INST#O
ENT
1B
4E
0A
0A ENT
1B
5F
0A
0A
Handheld Programmer Keystrokes
DirectSOFT
230
240
250-1
260
262
�����
Discrete Bit Flags Description SP63 On when the result of the instruction causes the value in the accumulator to be zeroSP70 On anytime the value in the accumulator is negative
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-135
Chapter 5: Standard RLL Instructions
Real to Binary Conversion (RTOB)The Real-to-Binary instruction converts the real number in the accumulator to a binary value. The result resides in the accumulator. Both the binary and the real number may use all 32 bits of the accumulator.
NOTE 1: The decimal portion of the result will be rounded down (14.1 to 14 or - 14.1 to -15). NOTE 2: If the real number is negative, it becomes a signed decimal value.
In the following example, when X1 is on, the value in V1400 and V1401 is loaded into the accumulator using the Load Double instruction. The RTOB instruction converts the real value in the accumulator the equivalent binary number format. The value in the accumulator is copied to V1500 and V1501 using the Out Double instruction. The Handheld Programmer would display the binary value in V1500 and V1501 as a HEX value.
RTOB
Standard R
LLInstructions
V1400V1401
DirectSOFT
LDDV1400
X1
Load the value in V1400 andV1401 into the accumulator
RTOB
Convert the real number inthe accumulator to binaryformat.
0 1 1 1 0 0 1 0 0 0 1 0 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1
8 4 2 1 8 4 2 1 8 4 2 1 8 4 2 18 4 2 1 8 4 2 1 8 4 2 1 8 4 2 1
Acc.
V1500V1501
Binary Value
Copy the real value in theaccumulator to V1500 and V1501
OUTDV1500
0 0 1 0 1 0 0 0 0 0 1 0 0 0 0 00 1 0 0 1 0 0 0 1 0 1 0 1 1 1 0Acc.
Real Number Format
Mantissa (23 bits)Exponent (8 bits)Sign Bit
2 (exp 18)
127 + 18 = 145128 + 16 + 1 = 145
STR$
SHFT ANDSTL
3D
3D
SHFT 1B
MLRT
ORNR ENT
OUTGX SHFT 3
D
1B ENT
INST#O
ENT
1B
4E
0A
0A ENT
1B
5F
0A
0A
Handheld Programmer Keystrokes
4 8 284EA 0
0 0 42750 1 The binary number copied to V1400
230
240
250-1
260
262
�����
Discrete Bit Flags Description SP63 On when the result of the instruction causes the value in the accumulator to be zeroSP70 On anytime the value in the accumulator is negativeSP72 On anytime the value in the accumulator is a valid floating point numberSP73 On when a signed addition or subtraction results in an incorrect sign bit.SP75 On when a number cannot be converted to binary
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B5-136
Chapter 5: Standard RLL Instructions
Radian Real Conversion (RADR)The Radian Real Conversion instruction converts the real degree value stored in the accumulator to the equivalent real number in radians. The result resides in the accumulator.
Degree Real Conversion (DEGR)The Degree Real instruction converts the degree real radian value stored in the accumulator to the equivalent real number in degrees. The result resides in the accumulator.
The two instructions described above convert real numbers in the accumulator from degree format to radian format, and visa-versa. In degree format, a circle contains 360 degrees. In radian format, a circle contains 2 P. These convert between both positive and negative real numbers, and for angles greater than a full circle. These functions are very useful when combined with the transcendental trigonometric functions (see the section on math instructions).
NOTE: The current HPP does not support real number entry with automatic conversion to the 32-bit IEEE format. You must use DirectSOFT for entering real numbers, using the LDR (Load Real) instruction.
The following example takes the sine of 45 degrees. Since transcendental functions operate only on real numbers, we do a LDR (Load Real) 45. The trig functions operate only in radians, so we must convert the degrees to radians by using the RADR command. After using the SINR (Sine Real) instruction, we use an OUTD (Out Double) instruction to move the result from the accumulator to V-memory. The result is 32-bits wide, requiring the Out Double to move it.
RADR�����
230
240
250-1
260
262
DEGR�����
230
240
250-1
260
262
Discrete Bit Flags Description SP63 On when the result of the instruction causes the value in the accumulator to be zeroSP70 On anytime the value in the accumulator is negativeSP71 On anytime the V-memory specified by a pointer (P) is not validSP72 On anytime the value in the accumulator is a valid floating point numberSP74 On anytime a floating point math operation results in an underflow errorSP75 On when a BCD instruction is executed and a NON-BCD number was encountered
LDRR45
X1 Load the real number 45 intothe accumulator.
RADR Convert the degrees into radians,leaving the result in theaccumulator.
OUTDV2000
Copy the value in theaccumulator to V2000and V2001.
45.000000
Accumulator contents(viewed as real number)
0.7853982
SINR Take the sine of the number inthe accumulator, which is inradians.
0.7071067
0.7071067
DirectSOFT
DS UsedHPP N/A
DL205 User Manual, 5th Edition, Rev. B 5-137
Chapter 5: Standard RLL Instructions
ASCII to HEX (ATH)The ASCII TO HEX instruction converts a table of ASCII values to a specified table of HEX values. ASCII values are two digits and their HEX equivalents are one digit.
This means an ASCII table of four V-memory locations would only require two V-memory locations for the equivalent HEX table. The function parameters are loaded into the accumulator stack and the accumulator by two additional instructions. Listed below are the steps necessary to program an ASCII to HEX table function. The example on the following page shows a program for the ASCII to HEX table function.
Step 1: Load the number of V-memory locations for the ASCII table into the first level of the accumulator stack.
Step 2: Load the starting V-memory location for the ASCII table into the accumulator. This parameter must be a HEX value.
Step 3: Specify the starting V-memory location (Vaaa) for the HEX table in the ATH instruction.
Helpful hint: — For parameters that require HEX values when referencing memory locations, the LDA instruction can be used to convert an octal address to the HEX equivalent and load the value into the accumulator.
In the example on the following page, when X1 is ON, the constant (K4) is loaded into the accumulator using the Load instruction and will be placed in the first level of the accumulator stack when the next Load instruction is executed. The starting location for the ASCII table (V1400) is loaded into the accumulator using the Load Address instruction. The starting location for the HEX table (V1600) is specified in the ASCII to HEX instruction. The table below lists valid ASCII values for ATH conversion.
aaaATH
V
230
240
250-1
260
262
�����
Operand Data TypeRange
D2-250-1 D2-260/D2-262aaa aaa
V-memory V All (See page 3-56) All (See page 3-57)
ASCII Values Valid for ATH ConversionASCII Hex Value ASCII Value Hex Value
30 0 38 831 1 39 932 2 41 A33 3 42 B34 4 43 C35 5 44 D36 6 45 E37 7 46 F
DS UsedHPP N/A
DL205 User Manual, 5th Edition, Rev. B5-138
Chapter 5: Standard RLL Instructions
HEX to ASCII (HTA)The HEX to ASCII instruction converts a table of HEX values to a specified table of ASCII values. HEX values are one digit and their ASCII equivalents are two digits.
This means a HEX table of two V-memory locations would require four V-memory locations for the equivalent ASCII table. The function parameters are loaded into the accumulator stack and the accumulator by two additional instructions. Listed below are the steps necessary to program a HEX to ASCII table function. The example on the following page shows a program for the HEX to ASCII table function.
Step 1: Load the number of V-memory locations in the HEX table into the first level of the accumulator stack.
Step 2: Load the starting V-memory location for the HEX table into the accumulator. This parameter must be a HEX value.
Step 3: Specify the starting V-memory location (Vaaa) for the ASCII table in the HTA instruction.
Helpful hint: — For parameters that require HEX values when referencing memory locations, the LDA instruction can be used to convert an octal address to the HEX equivalent and load the value into the accumulator.
DirectSOFT
LDK4
X1 Load the constant valueinto the lower 16 bits of theaccumulator. This valuedefines the number of Vmemory locations in theASCII table
LDAO 1400
Convert octal 1400 to HEX300 and load the value intothe accumulator
ATHV1600
V1600 is the startinglocation for the HEX table
ASCII TABLEHexadecimal Equivalents
123433 34V1400
5678
31 32V1401
37 38V1402
35 36V1403
V1600
V1601
STR$
SHFT ANDSTL
3D
7H
SHFT
MLRTSHFT
1B ENT
ENT
4E
0A
0A
ENT
1B
6G
0A
0A
Handheld Programmer Keystrokes
PREV
ANDSTL
3D ENT1
B4
E0
A0
A
aaaVHTA230
240
250-1
260
262
�����
Operand Data TypeRange
D2-250-1 D2-260/D2-262aaa aaa
V-memory V All (See page 3-56) All (See page 3-57)
DS UsedHPP N/A
DL205 User Manual, 5th Edition, Rev. B 5-139
Chapter 5: Standard RLL Instructions
In the following example, when X1 is ON, the constant (K2) is loaded into the accumulator using the Load instruction. The starting location for the HEX table (V1500) is loaded into the accumulator using the Load Address instruction. The starting location for the ASCII table (V1400) is specified in the HEX to ASCII instruction.
The table below lists valid ASCII values for HTA conversion.
DirectSOFT
LDK2
X1
Load the constant value intothe lower 16 bits of theaccumulator. This valuedefines the number of Vlocations in the HEX table.
LDAO 1500
Convert octal 1500 to HEX340 and load the value intothe accumulator
HTAV1400
V1400 is the startinglocation for the ASCII table.The conversion is executedby this instruction.
ASCII TABLEHexadecimal Equivalents
123433 34 V1400
5678
31 32 V1401
37 38 V1402
35 36 V1403
V1500
V1501
STR$
SHFT ANDSTL
3D
7H
SHFT
MLRTSHFT
1B ENT
ENT
2C
0A
0A
ENT
1B
4E
0A
0A
Handheld Programmer Keystrokes
PREV
ANDSTL
3D ENT1
B5
F0
A0
A
ASCII Values Valid for HTA ConversionHex Value ASCII Value Hex Value ASCII Value
0 30 8 381 31 9 392 32 A 413 33 B 424 34 C 435 35 D 446 36 E 457 37 F 46
DL205 User Manual, 5th Edition, Rev. B5-140
Chapter 5: Standard RLL Instructions
Segment (SEG)The BCD / Segment instruction converts a 4digit HEX value in the accumulator to a 7-segment display format. The result resides in the accumulator.
In the following example, when X1 is on, the value in V1400 is loaded into the lower 16 bits of the accumulator using the Load instruction. The binary (HEX) value in the accumulator is converted to 7-segment format using the Segment instruction. The bit pattern in the accumulator is copied to Y20–Y57 using the Out Formatted instruction.
SEG230
240
250-1
260
262
�����
-- g f e d c b a-- g f e d c b a -- g f e d c b a
SEG
X1
Convert the binary (HEX)value in the accumulator toseven segment displayformat
OUTF Y20K32
Copy the value in theaccumulator to Y20--Y57
LDV1400
Load the value in V1400 nto thelower 16 bits of the accumulator
0 1 1 0 1 1 1 1 0 1 1 1 0 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
6 F 7 1
V1400
0 0 0 0 0 1 1 1 0 0 0 0 0 1 1 00 1 1 1 1 1 0 1 0 1 1 1 0 0 0 1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
Y20Y21Y22Y23OFFONONOFF
Y24OFF
Y53Y54Y55Y56ONONONON
Y57OFF
-- g f e d c b a SegmentLabels
a
g
f
e
d
c
bSegment
Labels
Handheld Programmer Keystrokes
STR$
ANDSTL
3D
SHFT
1B ENT
2C
0A
4E
RSTS
3D
ENT6G
5F
ENT1B
4E
0A
0A
SHFT
OUTGX SHFT 2
C ENT
DirectSOFT
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-141
Chapter 5: Standard RLL Instructions
Gray Code (GRAY)The Gray code instruction converts a 16-bit gray code value to a BCD value. The BCD conversion requires 10 bits of the accumulator. The upper 22 bits are set to “0.” This instruction is designed for use with devices (typically encoders) that use the gray code numbering scheme. The Gray Code instruction will directly convert a gray code number to a BCD number for devices having a resolution of 512 or 1024 counts per revolution. If a device having a resolution of 360 counts per revolution is to be used, you must subtract a BCD value of 76 from the converted value to obtain the proper result. For a device having a resolution of 720 counts per revolution, you must subtract a BCD value of 152.
In the following example, when X1 is ON the binary value represented by X10–X27 is loaded into the accumulator using the Load Formatted instruction. The gray code value in the accumulator is converted to BCD using the Gray Code instruction. The value in the lower 16 bits of the accumulator is copied to V2010.
GRAY230
240
250-1
260
262
�����
Handheld Programmer Keystrokes
DirectSOFT
LDF K16X10
X1
Load the value representedby X10–X27 into the lower16 bits of the accumulator
GRAY
Convert the 16 bit grey codevalue in the accumulator to aBCD value
OUTV2010
Copy the value in the lower16 bits of the accumulator toV2010
0000000000
Gray Code BCD
0000000001
0000000011
0000000010
0000000110
0000000111
0000000101
0000000100
1000000001
1000000000
0000
0001
0002
0003
0004
0005
0006
0007
1022
1023
X10X11X12ONOFFON
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 00 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 031 30 29 28 27 26 25 24 23 22 21 20 19 18 17 1631 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Acc.
X25X26X27OFFOFFOFF
V2010
0 0 0 6
STR$
SHFT ANDSTL
3D
5F
SHFT 6G
ORNR
0A
MLSY ENT
OUTGX SHFT AND
V2
C0
A1
B0
A ENT
ENT1B
1B
0A ENT1
B6
G
•
•
• •
•
•
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B5-142
Chapter 5: Standard RLL Instructions
Shuffle Digits (SFLDGT)The Shuffle Digits instruction shuffles a maximum of 8 digits rearranging them in a specified order. This function requires parameters to be loaded into the first level of the accumulator stack and the accumulator with two additional instructions. Listed below are the steps necessary to use the Shuffle Digit function. The example on the following page shows a program for the Shuffle Digits function.
Step 1: Load the value (digits) to be shuffled into the first level of the accumulator stack.Step 2: Load the order that the digits will be shuffled to into the accumulator.Step 3: Insert the SFLDGT instruction.
NOTE: If the number used to specify the order contains a 0 or 9–F, the corresponding position will be set to 0.
See example on the next page.
NOTE: If the number used to specify the order contains duplicate numbers, the most significant duplicate number is valid. The result resides in the accumulator.
Shuffle Digits Block DiagramA maximum of 8 digits can be shuffled. The bit positions in the first level of the accumulator stack define the digits to be shuffled. They correspond to the bit positions in the accumulator that define the order in which the digits will be shuffled. The digits are shuffled and the result resides in the accumulator.
SFLDGT230
240
250-1
260
262
�����
Digits to beshuffled (first stack location)
Specified order (accumulator)
D E F 09 A B C
3 6 5 41 2 8 7
Result (accumulator)
0 D A 9B C E F
4 3 2 18 7 6 5Bit Positions
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-143
Chapter 5: Standard RLL Instructions
In the following examples, when input X1 is on, the value in the first level of the accumulator stack will be reorganized in the order specified by the value in the accumulator.
Example A shows how the shuffle digits works when 0 or 9 –F is not used when specifying the order the digits are to be shuffled. Also, there are no duplicate numbers in the specified order.
Example B shows how the shuffle digits works when a 0 or 9–F is used when specifying the order the digits are to be shuffled. Notice when the Shuffle Digits instruction is executed, the bit positions in the first stack location that had a corresponding 0 or 9–F in the accumulator (order specified) are set to “0”.
Example C shows how the shuffle digits works when duplicate numbers are used specifying the order the digits are to be shuffled. Notice when the Shuffle Digits instruction is executed, the most significant duplicate number in the order specified is used in the result.
D E F 09 A B C
Handheld Programmer Keystrokes
DirectSOFT
LDDV2000
X1
Load the value in V2000 andV2001 into the accumulator
LDDV2006
Load the value in V2006 andV2007 into the accumulator
OUTDV2010
Copy the value in theaccumulator to V2010 andV2011
SFLDGT
Shuffle the digits in the firstlevel of the accumulatorstack based on the patternin the accumulator. Theresult is in the accumulator.
V2010
Acc.
0 D A 9
9 A B C D E F 0
V2011
B C E F
Acc.
3 6 5 4
1 2 8 7 3 6 5 4
1 2 8 7
Acc.B C E F 0 D A 9
V2000V2001
V2006V2007
C B A 90 F E D
V2010
Acc.
E D A 9
0 F E D C B A 9
V2011
0 0 0 0
Acc.
0 0 2 1
0 0 4 3 0 0 2 1
0 0 4 3
Acc.0 0 0 0 E D A 9
V2000V2001
V2006V2007
D E F 09 A B C
V2010
Acc.
9 A B C
9 A B C D E F 0
V2011
0 0 0 0
Acc.
4 3 2 1
4 3 2 1 4 3 2 1
4 3 2 1
Acc.0 0 0 0 9 A B C
V2000V2001
V2006V2007
A B C
Original bitPositions
4 3 2 18 7 6 5 4 3 2 18 7 6 5 4 3 2 18 7 6 5
Specifiedorder
4 3 2 18 7 6 5 4 3 2 18 7 6 5 4 3 2 18 7 6 5
New bitPositions
4 3 2 18 7 6 5 4 3 2 18 7 6 5 4 3 2 18 7 6 5
STR$
SHFT ANDSTL
3D
3D
SHFT ANDSTL
3D
3D
SHFT RSTS
5F
ANDSTL
3D
6G
MLRT ENT
OUTGX SHFT 3
D
1B ENT
2C
0A
0A
0A ENT
2C
0A
0A ENT6
G
2C
0A
1B
0A ENT
SHFT
DL205 User Manual, 5th Edition, Rev. B5-144
Chapter 5: Standard RLL Instructions
Table InstructionsMove (MOV)
The Move instruction moves the values from a V-memory table to another V-memory table the same length. The function parameters are loaded into the first level of the accumulator stack and the accumulator by two additional instructions. Listed below are the steps necessary to program the Move function.
Step 1: Load the number of V-memory locations to be moved into the first level of the accumulator stack. This parameter is a HEX value (KFFF max, 7777 octal).
Step 2: Load the starting V-memory location for the locations to be moved into the accumulator. This parameter must be a HEX value.
Step 3: Insert the MOVE instruction which specifies starting V-memory location (Vaaa) for the destination table.
Helpful hint: — For parameters that require HEX values when referencing memory locations, the LDA instruction can be used to convert an octal address to the HEX equivalent and load the value into the accumulator.
In the following example, when X1 is on, the constant value (K6) is loaded into the accumulator using the Load instruction. This value specifies the length of the table and is placed in the first stack location after the Load Address instruction is executed. The octal address 2000 (V2000), the starting location for the source table is loaded into the accumulator. The destination table location (V2030) is specified in the Move instruction.
V aaaMOV
Operand Data TypeRange
D2-230 D2-240 D2-250-1 D2-260/D2-262aaa aaa aaa aaa
V-memory V All (See page 3-54) All (See page 3-55) All (See page 3-56) All (See page 3-57)Pointer P All (See page 3-54) All (See page 3-55) All (See page 3-56) All (See page 3-57)
Sta
ndar
d R
LLIn
stru
ctio
ns
Handheld Programmer Keystrokes
LD
K6
X1Load the constant value 6(HEX) into the lower 16 bitsof the accumulator
LDA
O 2000
Convert octal 2000 to HEX400 and load the value intothe accumulator
MOV
V2030
Copy the specified tablelocations to a tablebeginning at location V2030
V20300 1 2 3
V20310 5 0 0
V20329 9 9 9
V20333 0 7 4
V20348 9 8 9
V20351 0 1 0
V2036X X X X
V2037X X X X
V2026X X X X
V2027X X X X
V20000 1 2 3
V20010 5 0 0
V20029 9 9 9
V20033 0 7 4
V20048 9 8 9
V20051 0 1 0
V2006X X X X
V2007X X X X
V1776X X X X
V1777X X X X
STR$
SHFTANDSTL
3D SHFT
JMPK
6G ENT
SHFTANDSTL
3D
0A
2C
0A
0A
0A ENT
SHFTORSTM
INST#O
1B ENT
2C
0A
0A ENT
3D
ANDV
DS UsedHPP Used
�����
230
240
250-1
260
262
DL205 User Manual, 5th Edition, Rev. B 5-145
Chapter 5: Standard RLL Instructions
Move Memory Cartridge (MOVMC)
Load Label (LDLBL)The Move Memory Cartridge instruction is used to copy data between V-memory and program ladder memory. The Load Label instruction is only used with the MOVMC instruction when copying data from program ladder memory to V-memory.
To copy data between V-memory and program ladder memory, the function parameters are loaded into the first two levels of the accumulator stack and the accumulator by two additional instructions. Listed below are the steps necessary to program the Move Memory Cartridge and Load Label functions.
Step 1: Load the number of words to be copied into the second level of the accumulator stack.
Step 2: Load the offset for the data label area in the program ladder memory and the beginning of the V-memory block into the first level of the accumulator stack.
Step 3: Load the source data label (LDLBL Kaaa) into the accumulator when copying data from ladder memory to V-memory. Load the source address into the accumulator when copying data from V-memory to ladder memory. This is where the value will be copied from. If the source address is a V-memory location, the value must be entered in HEX.
Step 4: Insert the MOVMC instruction which specifies destination (Aaaa). This is where the value will be copied to.
WARNING: The offset for this usage of the instruction starts at 0, but may be any number that does not result in data outside of the source data area being copied into the destination table. When an offset is outside of the source information boundaries, then unknown data values will be transferred into the destination table.
V aaaMOVMC
LDLBLaaaK
Operand Data TypeRange
D2-230 D2-240 D2-250-1 D2-260/D2-262aaa aaa aaa aaa
V-memory V All (See page 3-54) All (See page 3-55) All (See page 3-56) All (See page 3-57)Constant K K1-KFFFF K1-KFFFF K1-KFFFF K1-KFFFF
DS UsedHPP Used
�����
230
240
250-1
260
262
DL205 User Manual, 5th Edition, Rev. B5-146
Chapter 5: Standard RLL Instructions
Copy Data From a Data Label Area to V-MemoryIn the following example, data is copied from a Data Label Area to V-memory. When X1 is on, the constant value (K4) is loaded into the accumulator using the Load instruction. This value specifies the length of the table and is placed in the second stack location after the next Load and Load Label (LDLBL) instructions are executed. The constant value (K0) is loaded into the accumulator using the Load instruction. This value specifies the offset for the source and destination data, and is placed in the first stack location after the LDLBL instruction is executed. The source address where data is being copied from is loaded into the accumulator using the LDLBL instruction. The MOVMC instruction specifies the destination starting location and executes the copying of data from the Data Label Area to V-memory.
WARNING: The offset for this usage of the instruction starts at 0, but may be any number that does not result in data outside of the source data area being copied into the destination table. When an offset is outside of the source information boundaries, then unknown data values will be transferred into the destination table.
Sta
ndar
d R
LLIn
stru
ctio
ns
1 2 3 4C O N
4 5 3 2C O N
6 1 5 1C O N
8 8 4 5C O N
KN
KN
KN
KN
DirectSOFT
Handheld Programmer Keystrokes
LDK4
X1
Load the value 4 into theaccumulator specifying thenumber of locations to becopied.
LDK0
Load the value 0 into theaccumulator specifying theoffset for source anddestination locations
LDLBLK1
Load the value 1 into theaccumulator specifying theData Label Area K1 as thestarting address of the datato be copied.
V2001
V20026 1 5 1
V20038 8 4 5
V2004X X X X
V1777
V20001 2 3 4
Data Label AreaProgrammedAfter the ENDInstruction
MOVMCV2000
V2000 is the destinationstarting address for the datato be copied.
DLBL K1
STR$
SHFT ANDSTL
3D SHFT JMP
K ENT
SHFT ANDSTL
3D
ANDSTL
1B
ANDSTL
SHFT ORSTM
ANDV
INST#O
ORSTM
2C
1B ENT
ENT1B
2C
0A
0A
0A ENT
SHFT ANDSTL
3D SHFT JMP
K0
A ENT
4E
X X X X
4 5 3 2
DS UsedHPP Used
�����
230
240
250-1
260
262
DL205 User Manual, 5th Edition, Rev. B 5-147
Chapter 5: Standard RLL Instructions
Copy Data From V-Memory to a Data Label AreaIn the following example, data is copied from V-memory to a data label area. When X1 is on, the constant value (K4) is loaded into the accumulator using the Load instruction. This value specifies the length of the table and is placed in the second stack location after the next Load and Load Address instructions are executed. The constant value (K2) is loaded into the accumulator using the Load instruction. This value specifies the offset for the source and destination data, and is placed in the first stack location after the Load Address instruction is executed. The source address where data is being copied from is loaded into the accumulator using the Load Address instruction. The MOVMC instruction specifies the destination starting location and executes the copying of data from V-memory to the data label area.
WARNING: The offset for this usage of the instruction starts at 0. If the offset (or the specified data table range) is large enough to cause data to be copied from V-memory to beyond the end of the DLBL area, then anything after the specified DLBL area will be replaced with invalid instructions.
����
230
240
250-1
260
6 1 5 1C O N
8 8 4 5C O N
2 5 0 0C O N
6 8 3 5C O N
KN
KN
KN
KN
DirectSOFT
Handheld Programmer Keystrokes
LDK4
X1
Load the value 4 into theaccumulator specifying thenumber of locations to becopied.
LDK2
Load the value 2 into theaccumulator specifying theoffset for source anddestination locations.
LDA O 2000
V20014 5 3 2
V20026 1 5 1
V20038 8 4 5
V20042 5 0 0
V1777X X X X
V20001 2 3 4
Data Label AreaProgrammedAfter the ENDInstruction
MOVMCK1
K1 is the data labeldestination area where thedata will be copied to
V20056 8 3 5
V2006X X X X
DLBL K1
Offset 7 0 4 1C O N
4 6 4 8C O N
KN
KN
Offset
Convert octal 2000 to HEX400 and load the value intothe accumulator. Thisspecifies the source locationwhere the data will becopied from
STR$
SHFT ANDSTL
3D SHFT JMP
K ENT4E
SHFT ANDSTL
3D
SHFT ORSTM
ANDV
INST#O
ORSTM
2C SHFT ENT
0A
2C
0A
0A
0A ENT
JMPK
1B
SHFT ANDSTL
3D SHFT JMP
K ENT2C
1B ENT
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B5-148
Chapter 5: Standard RLL Instructions
DL205 User Manual, 4th Edition, Rev. B
Set Bit (SETBIT)The Set Bit instruction sets a single bit to one within a range of V-memory locations.
Reset Bit (RSTBIT)The Reset Bit instruction resets a single bit to zero within a range of V-memory locations.
The following description applies to both the Set Bit and Reset Bit table instructions.Step 1: Load the length of the table (number of V-memory locations) into the first level of the
accumulator stack. This parameter must be a HEX value, 0 to FF.
Step 2: Load the starting V-memory location for the table into the accumulator. This parameter must be a HEX value. You can use the LDA instruction to convert an octal address to hex.
Step 3: Insert the Set Bit or Reset Bit instruction. This specifies the reference for the bit number of the bit you want to set or reset. The bit number is in octal, and the first bit in the table is number “0.”
Helpful hint: — Remember that each V-memory location contains 16 bits. So, the bits of the first word of the table are numbered from 0 to 17 octal. For example, if the table length is 6 words, then 6 words = (6 x 16) bits, = 96 bits (decimal), or 140 octal. The permissible range of bit reference numbers would be 0 to 137 octal. Flag 53 will be set if the bit specified is outside the range of the table.
NOTE: Status flags are only valid until the end of the scan or another instruction that uses the same flag is executed.
Operand Data Type Range D2-260/D2-262
aaaV-memory V All (See page 3-57)
V aaaSETBIT
V aaaRSTBIT
�����
230
240
250-1
260
262
�����
230
240
250-1
260
262
Discrete Bit Flags Description SP53 On when the bit number which is referred in the Set Bit or Reset Bit exceeds the range of
the table
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-149
Chapter 5: Standard RLL Instructions
5-149
For example, suppose we have a table starting at V3000 that is two words long, as shown to the right. Each word in the table contains 16 bits, or 0 to 17 in octal. To set bit 12 in the second word, we use its octal reference (bit 14). Then we compute the bit’s octal address from the start of the table, so 17 + 14 = 34 octal. The following program shows how to set the bit as shown to a “1.”
In this ladder example, we will use input X0 to trigger the Set Bit operation. First, we will load the table length (two words) into the accumulator stack. Next, we load the starting address into the accumulator. Since V3000 is an octal number we have to convert it to hex by using the LDA command. Finally, we use the Set Bit (or Reset Bit) instruction and specify the octal address of the bit (bit 34), referenced from the table beginning.
MSB LSBV3000
MSB LSBV3001
17
016
15
14
13
12
11
10
7 6 5 4 3 2 1
16 bits
Standard R
LL
Handheld Programmer Keystrokes
DirectSOFT
LDK2
X0 Load the constant value 2(Hex.) into the lower 16 bitsof the accumulator.
LDAO 3000
SETBITO 34
Set bit 34 (octal) in the tableto a ”1”.
Convert octal 3000 to HEXand load the value into theaccumulator. This is thetable beginning.
STR$
SHFT ANDSTL
3D
SHFT
0A ENT
2C
0A
ENT8I
MLRT
0A
0A
ANDSTL
3D ENT
SETX
3D
4E
1B
0A
PREV
NEXT
ENT
SHFT 3D
DL205 User Manual, 5th Edition, Rev. B5-150
Chapter 5: Standard RLL Instructions
Fill (FILL)The Fill instruction fills a table of up to 255 V-memory locations with a value (Aaaa), which is either a V-memory location or a 4-digit constant. The function parameters are loaded into the first level of the accumulator stack and the accumulator by two additional instructions. Listed below are the steps necessary to program the Fill function.
Step 1: Load the number of V-memory locations to be filled into the first level of the accumulator stack. This parameter must be a HEX value, 0 to FFFF.
Step 2: Load the starting V-memory location for the table into the accumulator. This parameter must be a HEX value.
Step 3: Insert the Fill instructions which specifies the value to fill the table with.
Helpful hint: For parameters that require HEX values when referencing memory locations, the LDA instruction can be used to convert an octal address to the HEX equivalent and load the value into the accumulator.
In the following example, when X1 is on, the constant value (K4) is loaded into the accumulator using the Load instruction. This value specifies the length of the table and is placed on the first level of the accumulator stack when the Load Address instruction is executed. The octal address 1600 (V1600) is the starting location for the table and is loaded into the accumulator using the Load Address instruction. The value to fill the table with (V1400) is specified in the Fill instruction.
FILLA aaa
�����
230
240
250-1
260
262
Sta
ndar
d R
LLIn
stru
ctio
ns
Handheld Programmer Keystrokes
DirectSOFT
LDK4
X1 Load the constant value 4(HEX) into the lower 16 bitsof the accumulator
LDAO 1600
Convert the octal address1600 to HEX 380 and load thevalue into the accumulator
FILLV1400
Fill the table with the valuein V1400
V1576
V1577
V1600
V1601
V1602
V1603
V1604
V1605
V1400
STR$
SHFT ANDSTL
3D
SHFT 5F
8I
ANDSTL
PREV
ANDSTL
1B ENT
4E
0A
0A
ENT
SHFT ANDSTL
3D
1B
6G
0A ENT
0A
1B
4E
0A ENT
2 5 0 0
2 5 0 0
2 5 0 0
2 5 0 0
2 5 0 0
Operand Data Type Range D2-260/D2-262
A aaaV-memory V All (See page 3-57)Pointer P All V mem (See page 3-57)Constant K 0-FFFF
Discrete Bit Flag DescriptionSP53 On if V-memory address is out of range
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-151
Chapter 5: Standard RLL Instructions
Find (FIND)The Find instruction is used to search for a specified value in a V-memory table of up to 255 locations. The function parameters are loaded into the first and second levels of the accumulator stack and the accumulator by three additional instructions. Listed below are the steps necessary to program the Find function.
Step 1: Load the length of the table (number of V-memory locations) into the second level of the accumulator stack. This parameter must be a HEX value, 0 to FFFF.
Step 2: Load the starting V-memory location for the table into the first level of the accumulator stack. This parameter must be a HEX value.
Step 3: Load the offset from the starting location to begin the search. This parameter must be a HEX value.
Step 4: Insert the Find instruction which specifies the first value to be found in the table.Results: The offset from the starting address to the first V-memory location which contains the
search value is returned to the accumulator as a HEX value. SP53 will be set on if an address outside the table is specified in the offset or the value is not found. If the value is not found, 0 will be returned in the accumulator.
Helpful hint: For parameters that require HEX values when referencing memory locations, the LDA instruction can be used to convert an octal address to the HEX equivalent and load the value into the accumulator.
NOTE: Status flags are only valid until another instruction that uses the same flags is executed. The pointer for this instruction starts at 0 and resides in the accumulator.
In the example on the following page, when X1 is on, the constant value (K6) is loaded into the accumulator using the Load instruction. This value specifies the length of the table and is placed in the second stack location when the following Load Address and Load instruction is executed. The octal address 1400 (V1400) is the starting location for the table and is loaded into the accumulator. This value is placed in the first level of the accumulator stack when the following Load instruction is executed. The offset (K2) is loaded into the lower 16 bits of the accumulator using the Load instruction. The value to be found in the table is specified in the Find instruction. If a value is found equal to the search value, the offset (from the starting location of the table) where the value is located will reside in the accumulator.
FINDA aaa
�����
230
240
250-1
260
262
Operand Data Type Range D2-260/D2-262
A aaaV-memory V All (See page 3-57)Constant K 0-FFFF
Discrete Bit Flag Description SP53 On if there is no value in the table that is equal to the search value.
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B5-152
Chapter 5: Standard RLL Instructions
Find Greater Than (FDGT)The Find Greater Than instruction is used to search for the first occurrence of a value in a V-memory table that is greater than the specified value (Aaaa), which can be either a V-memory location or a 4-digit constant. The function parameters are loaded into the first level of the accumulator stack and the accumulator by two additional instructions. Listed below are the steps necessary to program the Find Greater Than function.
NOTE: This instruction does not have an offset, such as the one required for the FIND instruction.
Step 1: Load the length of the table (up to 255 locations) into the first level of the accumulator stack. This parameter must be a HEX value, 0 to FFFF.
Step 2: Load the starting V-memory location for the table into the accumulator. This parameter must be a HEX value.
Step 3: Insert the FDGT instruction which specifies the greater than search value.Results: The offset from the starting address to the first V-memory location which contains the
greater than search value is returned to the accumulator as a HEX value. SP53 will be set on if the value is not found and 0 will be returned in the accumulator.
Helpful hint: For parameters that require HEX values when referencing memory locations, the LDA instruction can be used to convert an octal address to the HEX equivalent and load the value into the accumulator.
FDGTA aaa
�����
230
240
250-1
260
262
Load the constant value 6(HEX) into the lower 16 bitsof the accumulator
LDK6
X1
LDAO 1400
LDK2
V1400 0
V1401 1
V1402 2
V1403 3
V1404 4
V1405 5
V1406
V1407
0 1 2 3
0 5 0 0
9 9 9 9
3 0 7 4
8 9 8 9
1 0 1 0
X X X X
X X X X
Handheld Programmer Keystrokes
SHFT ANDSTL
3D
STR$
SHFT ANDSTL
3D PREV
5FSHFT 8
I3
DTMR
N8
I
1B ENT
PREV 6G ENT
J
ENT
SHFT ANDSTL
3D
1B
4E
0A
8I
2C
ENT
0A
FINDK8989
Convert octal 1400 to HEX300 and load the value into the accumulator
Load the constant value 2into the lower 16 bits ofthe accumulator
Find the location in the tablewhere the value 8989 resides
Offset
Begin here
Table length
Accumulator0 0 0 0 0 0 0 4
V1404 contains the locationwhere the match was found.The value 8989 was the 4thlocation after the start of thespecified table.
NEXT J9 9
0A ENT
DirectSOFT
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-153
Chapter 5: Standard RLL Instructions
NOTE: Status flags are only valid until another instruction that uses the same flags is executed. The pointer for this instruction starts at 0 and resides in the accumulator.
In the following example, when X1 is on, the constant value (K6) is loaded into the accumulator using the Load instruction. This value specifies the length of the table and is placed in the first stack location after the Load Address instruction is executed. The octal address 1400 (V1400) is the starting location for the table and is loaded into the accumulator. The greater than search value is specified in the Find Greater Than instruction. If a value is found greater than the search value, the offset (from the starting location of the table) where the value is located will reside in the accumulator. If there is no value in the table that is greater than the search value, a zero is stored in the accumulator and SP53 will come ON.
Discrete Bit Flags Description SP53 On if there is no value in the table that is equal to the search value.
Operand Data Type Range D2-260/D2-262
A aaaV-memory V All (See page 3-57)Constant K 0-FFFF
Load the constant value 6(HEX) into the lower 16 bitsof the accumulator
LDK6
X1
LDAO1400
V1400 0
V1401 1
V1402 2
V1403 3
V1404 4
V1405 5
V1406
V1407
0 1 2 3
0 5 0 0
9 9 9 9
3 0 7 4
8 9 8 9
1 0 1 0
X X X X
X X X X
FDGTK8989
Convert octal 1400 to HEX300 and load the value into the accumulator
Find the value in the tablegreater than the specified value
Begin here Table length
Accumulator0 0 0 0 0 0 0 2
V1402 contains the locationwhere the first value greaterthan the search value was found. 9999 was the 2ndlocation after the start of thespecified table.
Handheld Programmer Keystrokes
SHFT ANDSTL
3D
STR$
5FSHFT 3
D6
GMLR
T8
I
1B ENT
PREV 6G ENT
J
SHFT ANDSTL
3D
1B
4E
0A
8I ENT
0A
NEXT J9 9
0A ENT
DirectSOFT
DL205 User Manual, 5th Edition, Rev. B5-154
Chapter 5: Standard RLL Instructions
Table to Destination (TTD)The Table To Destination instruction moves a value from a V-memory table to a V-memory location and increments the table pointer by 1. The first V-memory location in the table contains the table pointer which indicates the next location in the table to be moved. The instruction will be executed once per scan provided the input remains on. The table pointer will reset to 1 when the value equals the last location in the table. The function parameters are loaded into the first level of the accumulator stack and the accumulator by two additional instructions. Listed below are the steps necessary to program the Table To Destination function.
Step 1: Load the length of the data table (number of V-memory locations) into the first level of the accumulator stack. This parameter must be a HEX value, 0 to FF.
Step 2: Load the starting V-memory location for the table into the accumulator. (Remember, the starting location of the table is used as the table pointer.) This parameter must be a HEX value.
Step 3: Insert the TTD instruction that specifies the destination V-memory location (Vaaa).
Helpful hint: For parameters that require HEX values when referencing memory locations, the LDA instruction can be used to convert an octal address to the HEX equivalent and load the value into the accumulator.
Helpful hint: The instruction will be executed every scan if the input logic is on. If you do not want the instruction to execute for more than one scan, a one shot (PD) should be used in the input logic.
Helpful hint: The pointer location should be set to the value where the table operation will begin. The special relay SP0 or a one shot (PD) should be used so the value will only be set in one scan and will not affect the instruction operation.
NOTE: Status flags (SPs) are only valid until: — another instruction that uses the same flag is executed, or — the end of the scan. The pointer for this instruction starts at 0 and resets when the table length is reached. At first glance it may appear that the pointer should reset to 0. However, it resets to 1, not 0.
TTDaaaV
TTDaaa
�����
230
240
250-1
260
262
Operand Data Type Range D2-260/D2-262
aaaV-memory V All (See page 3 - 56)
DS UsedHPP Used
Discrete Bit Flags Description SP53 On if there is no value in the table that is equal to the search value.
DL205 User Manual, 5th Edition, Rev. B 5-155
Chapter 5: Standard RLL Instructions
In the following example, when X1 is on, the constant value (K6) is loaded into the accumulator using the Load instruction. This value specifies the length of the table and is placed in the first stack location after the Load Address instruction is executed. The octal address 1400 (V1400) is the starting location for the source table and is loaded into the accumulator. Remember, V1400 is used as the pointer location, and is not actually part of the table data source. The destination location (V1500) is specified in the Table to Destination instruction. The table pointer (V1400 in this case) will be increased by “1” after each execution of the TTD instruction.
It is important to understand how the table locations are numbered. If you examine the example table, you’ll notice that the first data location, V1401, will be used when the pointer is equal to 0, and again when the pointer is equal to 6. Why? Because the pointer is only equal to 0 before the very first execution. From then on, it increments from 1 to 6, and then resets to 1.
Also, our example uses a normal input contact (X1) to control the execution. Since the CPU scan is extremely fast, and the pointer increments automatically, the table would cycle through the locations very quickly. If this is a problem, you have an option of using SP56 in conjunction with a one-shot (PD) and a latch (C1 for example) to allow the table to cycle through all locations one time and then stop. The logic shown here is not required, it’s just an optional method.
X1 LDK6
LDA0 1400
TTD
V1500
Load the constant value 6(HEX) into the lower 16 bitsof the accumulator
Convert octal 1400 to HEX 300 and load the value into the accumulator. This is thetable pointer location
Copy the specified value fromthe table to the specifieddestination (V1500)
Handheld Programmer Keystrokes
STR$
SHFT ANDSTL
3D
SHFT MLRT
MLRT
3D
PREV
1B ENT
6G
0A
0A
ENT
SHFT ANDSTL
3D
1B
4E
0A ENT
0A
1B
5F
0A ENT
DirectSOFT
DirectSOFT Display (optional latch example using SP56)
LDK6
C1
C0
SP56
X1 C0PD
C1SET
Since Special Relays are reset at the end of the scan,this latch must follow the TTDinstruction in the program.
Load the constant value 6(HEX) into the lower 16 bitsof the accumulator
C1RST
V1401 0 5 0 0
V1402 9 9 9 9
V1403 3 0 7 4
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
V1500X X X X
1
2
3
4
5
0 6 V14000 0 0
Table Table Pointer
Destination
.
.
0
DL205 User Manual, 5th Edition, Rev. B5-156
Chapter 5: Standard RLL Instructions
The following diagram shows the scan-by-scan results of the execution for our example program. Notice how the pointer automatically cycles from 0 to 6, and then starts over at 1 instead of 0. Also, notice how SP56 is only on until the end of the scan.
Table Pointer (Automatically Incremented)
Table Pointer (Automatically Incremented)
V1401 0 5 0 0
V1402 9 9 9 9
V1403 3 0 7 4
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
.
.
V1500X X X X
Before TTD Execution After TTD ExecutionScan N
0 6
1
2
3
4
5
After TTD ExecutionScan N+1
After TTD ExecutionScan N+5
Destination
V14000 0 0 0
Table PointerTable
V1401 0 5 0 0
V1402 9 9 9 9
V1403 3 0 7 4
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
.
.
V15000 5 0 0
0
1
2
3
4
5
Destination
V14000 0 0 1
Table Pointer (Automatically Incremented)Table
V1401 0 5 0 0
V1402 9 9 9 9
V1403 3 0 7 4
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
V15009 9 9 9
0 6
1
2
3
4
5
Destination
V14000 0 0 2
Table
V1401 0 5 0 0
V1402 9 9 9 9
V1403 3 0 7 4
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
V15002 0 4 6
0 6
1
2
3
4
5
Destination
V14000 0 0 6
Table
Before TTD Execution
V1401 0 5 0 0
V1402 9 9 9 9
V1403 3 0 7 4
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
V15000 5 0 0
0 6
1
2
3
4
5
Destination
V14000 0 0 1
Table PointerTable
V1401 0 5 0 0
V1402 9 9 9 9
V1403 3 0 7 4
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
V15001 0 1 0
0 6
1
2
3
4
5
Destination
V14000 0 0 5
Table PointerTable
Before TTD Execution
SP56 = OFFSP56
SP56 = OFFSP56
SP56 = ONSP56
Table Pointer (Resets to 1, not 0)
After TTD ExecutionScan N+6
V1401 0 5 0 0
V1402 9 9 9 9
V1403 3 0 7 4
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
V15000 5 0 0
1
2
3
4
5
Destination
V14000 0 0 1
Table
V1401 0 5 0 0
V1402 9 9 9 9
V1403 3 0 7 4
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
V15002 0 4 6
0 6
1
2
3
4
5
Destination
V14000 0 0 6
Table PointerTable
Before TTD Execution
SP56 = OFFSP56
SP56 = OFFSP56
SP56 = OFFSP56
SP56 = OFFSP56
SP56 = OFFSP56
6
0 6
until end of scanor next instructionthat uses SP56
.
...
.
.
.
.
.
.
.
.
...
DL205 User Manual, 5th Edition, Rev. B 5-157
Chapter 5: Standard RLL Instructions
Remove from Bottom (RFB)The Remove From Bottom instruction moves a value from the bottom of a V-memory table to a V-memory location and decrements a table pointer by 1. The first V-memory location in the table contains the table pointer which indicates the next location in the table to be moved. The instruction will be executed once per scan provided the input remains on. The instruction will stop operation when the pointer equals 0. The function parameters are loaded into the first level of the accumulator stack and the accumulator by 2 additional instructions. Listed below are the steps necessary to program the Remove From Bottom function.
Step 1: Load the length of the table (number of V-memory locations) into the first level of the accumulator stack. This parameter must be a HEX value, 0 to FF.
Step 2: Load the starting V-memory location for the table into the accumulator. (Remember, the starting location of the table blank is used as the table pointer.) This parameter must be a HEX value.
Step 3: Insert the RFB instructions which specifies destination V-memory location (Vaaa).
Helpful hint: For parameters that require HEX values when referencing memory locations, the LDA instruction can be used to convert an octal address to the HEX equivalent and load the value into the accumulator.
Helpful hint: The instruction will be executed every scan if the input logic is on. If you do not want the instruction to execute for more than one scan, a one shot (PD) should be used in the input logic.
Helpful hint: The pointer location should be set to the value where the table operation will begin. The special relay SP0 or a one shot (PD) should be used so the value will only be set in one scan and will not affect the instruction operation.
NOTE: Status flags (SPs) are only valid until: — another instruction that uses the same flag is executed, or — the end of the scan. The pointer for this instruction can be set to start anywhere in the table. It is not set automatically. You have to load a value into the pointer somewhere in your program.
aaaVRFB�
����
230
240
250-1
260
262
Discrete Bit Flags Description SP56 On when the table pointer equals 0
Operand Data Type Range D2-260/D2-262
aaaV-memory V All (See page 3-57)
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B5-158
Chapter 5: Standard RLL Instructions
In the following example, when X1 is on, the constant value (K6) is loaded into the accumulator using the Load instruction. This value specifies the length of the table and is placed in the first stack location after the Load Address instruction is executed. The octal address 1400 (V1400) is the starting location for the source table and is loaded into the accumulator. Remember, V1400 is used as the pointer location, and is not actually part of the table data source. The destination location (V1500) is specified in the Remove From Bottom. The table pointer (V1400 in this case) will be decremented by “1” after each execution of the RFB instruction.
I t i s important to understand how the table locations are numbered. If you examine the e x a m p l e table, you’ll notice that the first data location, V1401, will be used when the pointer is equal to one. The second data location, V1402, will be used when the pointer is equal to two, etc.
A l s o , our example uses a n o r m a l input contact (X1) to c o n t r o l the execution. Since the CPU scan is extremely fast, and the pointer decrements
automatically, the table would cycle through the locations very quickly. If this is a problem for your applicaton, you have an option of using a one-shot (PD) to remove one value each time the input contact transitions from low to high.
X1
Handheld Programmer Keystrokes
STR$
SHFT ANDSTL
3D
SHFT ORNR
5F
1B
PREV
1B ENT
6G
0A
0A
ENT
SHFT ANDSTL
3D
1B
4E
0A ENT
0A
1B
5F
0A ENT
LD
K6
LDA
0 1400
RFB
V1500
Load the constant value 6(HEX) into the lower 16 bitsof the accumulator
Convert octal 1400 to HEX300 and load the value intothe accumulator. This is thetable pointer location
Copy the specified value fromthe table to the specified destination (V1500)
DirectSOFT
V1401 0 5 0 0
V1402 9 9 9 9
V1403 3 0 7 4
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
SS
V1500X X X X
1
2
3
4
5
6
Destination
V14000 0 0 0
Table PointerTable
LDK6
C0
X1 C0PD
Load the constant value 6(HEX) into the lower 16 bitsof the accumulator
LDAO 1400
Convert octal 1400 to HEX300 and load the value intothe accumulator. This is thetable pointer location.
LDK6
C0
X1 C0PD
Load the constant value 6(HEX) into the lower 16 bitsof the accumulator
LDAO 1400
Convert octal 1400 to HEX300 and load the value intothe accumulator. This is thetable pointer location.
DirectSOFT (optional one-shot method)
DL205 User Manual, 5th Edition, Rev. B 5-159
Chapter 5: Standard RLL Instructions
The following diagram shows the scan-by-scan results of the execution for our example program. Notice how the pointer automatically decrements from 6 to 0. Also, notice how SP56 is only on until the end of the scan.
Before RFB Execution After RFB Execution
Before RFB Execution After RFB Execution
Before RFB Execution After RFB Execution
1
2
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6
1
2
3
4
5
6
Table Pointer (Automatically Decremented)
Table Pointer (Automatically Decremented)
V1401 0 5 0 0
V1402 9 9 9 9
V1403 3 0 7 4
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
.
.
V1500X X X X
Before RFB Execution After RFB Execution
Example of Execution
Scan N
1
2
3
4
5
6
Scan N+1
Scan N+4
Destination
V14000 0 0 6
Table PointerTable
V1401 0 5 0 0
V1402 9 9 9 9
V1403 3 0 7 4
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
V15002 0 4 6
Destination
V14000 0 0 5
Table Pointer (Automatically Decremented)Table
V1401 0 5 0 0
V1402 9 9 9 9
V1403 3 0 7 4
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
.
.
V15001 0 1 0
Destination
V14000 0 0 4
Table
V1401 0 5 0 0
V1402 9 9 9 9
V1403 3 0 7 4
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
.
.
V15009 9 9 9
Destination
V14000 0 0 1
Table
V1401 0 5 0 0
V1402 9 9 9 9
V1403 3 0 7 4
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
.
.
V15002 0 4 6
1
2
3
4
5
6
Destination
V14000 0 0 5
Table PointerTable
V1401 0 5 0 0
V1402 9 9 9 9
V1403 3 0 7 4
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
.
.
V15003 0 7 4
1
2
3
4
5
6
Destination
V14000 0 0 2
Table PointerTable
.
.
.
SP56 = OFFSP56
SP56 = OFFSP56
SP56 = OFFSP56
Table Pointer
Scan N+5
V1401 0 5 0 0
V1402 9 9 9 9
V1403 3 0 7 4
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
V15000 5 0 0
Destination
V14000 0 0 0
Table
V1401 0 5 0 0
V1402 9 9 9 9
V1403 3 0 7 4
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
.
.
V15009 9 9 9
1
2
3
4
5
6
Destination
V14000 0 0 1
Table PointerTable
SP56 = ONSP56
SP56 = OFFSP56
SP56 = OFFSP56
SP56 = OFFSP56
SP56 = OFFSP56
until end of scanor next instructionthat uses SP56
.
.
.
.
DL205 User Manual, 5th Edition, Rev. B5-160
Chapter 5: Standard RLL Instructions
Source to Table (STT)The Source To Table instruction moves a value from a V-memory location into a V-memory table and increments a table pointer by 1. When the table pointer reaches the end of the table, it resets to 1. The first V-memory location in the table contains the table pointer which indicates the next location in the table to store a value. The instruction will be executed once per scan provided the input remains on. The function parameters are loaded into the first level of the accumulator stack and the accumulator with two additional instructions. Listed below are the steps necessary to program the Source To Table function.
Step 1: Load the length of the table (number of V-memory locations) into the first level of the accumulator stack. This parameter must be a HEX value, 0 to FF.
Step 2: Load the starting V-memory location for the table into the accumulator. (Remember, the starting location of the table is used as the table pointer.) This parameter must be a HEX value.
Step 3: Insert the STT instruction which specifies the source V-memory location (Vaaa). This is where the value will be moved from.
Helpful hint: For parameters that require HEX values when referencing memory locations, the LDA instruction can be used to convert an octal address to the HEX equivalent and load the value into the accumulator.
Helpful hint: The instruction will be executed every scan if the input logic is on. If you do not want the instruction to execute for more than one scan, a one shot (PD) should be used in the input logic.
Helpful hint: The table counter value should be set to indicate the starting point for the operation. Also, it must be set to a value that is within the length of the table. For example, if the table is 6 words long, then the allowable range of values that could be in the pointer should be between 0 and 6. If the value is outside of this range, the data will not be moved. Also, a one shot (PD) should be used so the value will only be set in one scan and will not affect the instruction operation.
NOTE: Status flags (SPs) are only valid until: — another instruction that uses the same flag is executed, or — the end of the scan The pointer for this instruction starts at 0 and resets to 1 automatically when the table length is reached.
aaaVSTT�
����
230
240
250-1
260
262
Discrete Bit Flags Description SP56 On when the table pointer equals the table length.
Operand Data Type Range D2-260/D2-262
aaaV-memory V All (See page 3-57)
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-161
Chapter 5: Standard RLL Instructions
In the following example, when X1 is on, the constant value (K6) is loaded into the accumulator using the Load instruction. This value specifies the length of the table and is placed in the first stack location after the Load Address instruction is executed. The octal address 1400 (V1400), which is the starting location for the destination table and table pointer, is loaded into the accumulator. The data source location (V1500) is specified in the Source to Table instruction. The table pointer will be increased by “1” after each time the instruction is executed.
It is important to understand how the table locations are numbered. If you examine the example table, you’ll notice that the first data storage location, V1401, will be used when the pointer is equal to 0, and again when the pointer is equal to 6. Why? Because the pointer is only equal to 0 before the very first execution. From then on, it increments from 1 to 6, and then resets to 1.
Also, our example uses a normal input contact (X1) to control the execution. Since the CPU scan is extremely fast, and the pointer increments automatically, the source data would be moved into all the table locations very quickly. If this is a problem for your application, you have an option of using a one-shot (PD) to move 1 value each time the input contact transitions from low to high.
DirectSOFT
X1
Handheld Programmer Keystrokes
STR$
SHFT ANDSTL
3D
SHFT RSTS
MLRT
MLRT
PREV
1B ENT
6G
0A
0A
ENT
SHFT ANDSTL
3D
1B
4E
0A ENT
0A
1B
5F
0A ENTSHFT
LD
K6
LDA
0 1400
STT
V1500
Load the constant value 6(HEX) into the the lower 16 bitsof the accumulator
Convert octal 1400 to HEX300 and load the value into the accumulator
Copy the specified value from the source location(V1500) to the table
V1401 X X X X
V1402 X X X X
V1403 X X X X
V1404 X X X X
V1405 X X X X
V1406 X X X X
V1407 X X X X
SS
V15000 5 0 0
0 6
1
2
3
4
5
Data S ource
V14000 0 0 0
Table PointerTable
DirectSOFT (optional one-shot method)
LDK6
C0
X1 C0PD
Load the constant value 6(HEX) into the lower 16 bitsof the accumulator
LDAO 1400
Convert octal 1400 to HEX300 and load the value intothe accumulator. This is thestarting table location.
DL205 User Manual, 5th Edition, Rev. B5-162
Chapter 5: Standard RLL Instructions
The following diagram shows the scan-by-scan results of the execution for our example program. Notice how the pointer automatically cycles from 0 to 6, and then starts over at 1 instead of 0. Also, notice how SP56 is affected by the execution. Although our example does not show it, we are assuming that there is another part of the program that changes the value in V1500 (data source) prior to the execution of the STT instruction. This is not required, but it makes it easier to see how the data source is copied into the table.
V1401 0 5 0 0
V1402 9 9 9 9
V1403 X X X X
V1404 X X X X
V1405 X X X X
V1406 X X X X
V1407 X X X X
Table
V1401 0 5 0 0
V1402 X X X X
V1403 X X X X
V1404 X X X X
V1405 X X X X
V1406 X X X X
V1407 X X X X
Table
V1401 0 5 0 0
V1402 X X X X
V1403 X X X X
V1404 X X X X
V1405 X X X X
V1406 X X X X
V1407 X X X X
Table
V1401 X X X X
V1402 X X X X
V1403 X X X X
V1404 X X X X
V1405 X X X X
V1406 X X X X
V1407 X X X X
0 6
1
2
3
4
5
Table
After STT Execution
After STT Execution
After STT Execution
Before STT Execution
Before STT Execution
Table Pointer (Automatically Incremented)
Table Pointer (Automatically Incremented)
V15000 5 0 0
Before STT Execution After STT ExecutionScan N
1
2
3
4
5
Scan N+1
Scan N+5
Source
V14000 0 0 0
Table Pointer
V15000 5 0 0
0
1
2
3
4
5
Source
V14000 0 0 1
Table Pointer (Automatically Incremented)
V15009 9 9 9
0 6
1
2
3
4
5
Source
V14000 0 0 2
V1401 0 5 0 0
V1402 9 9 9 9
V1403 3 0 7 4
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
V15002 0 4 6
0 6
1
2
3
4
5
Source
V14000 0 0 6
Table
Before STT Execution
V15009 9 9 9
0 6
1
2
3
4
5
Source
V14000 0 0 1
Table Pointer
V1401 0 5 0 0
V1402 9 9 9 9
V1403 3 0 7 4
V1404 8 9 8 9
V1405 1 0 1 0
V1406 X X X X
V1407 X X X X
V15002 0 4 6
0 6
1
2
3
4
5
Source
V14000 0 0 5
Table PointerTable
SP56 = OFFSP56
SP56 = OFFSP56
SP56 = ONSP56
Table Pointer (Resets to 1, not 0)
Scan N+6
V1401 1 2 3 4
V1402 9 9 9 9
V1403 3 0 7 4
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
V15001 2 3 4
1
2
3
4
5
Source
V14000 0 0 1
Table
V1401 0 5 0 0
V1402 9 9 9 9
V1403 3 0 7 4
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
V15001 2 3 4
0 6
1
2
3
4
5
Source
V14000 0 0 6
Table PointerTable
SP56 = OFFSP56
SP56 = OFFSP56
SP56 = OFFSP56
SP56 = OFFSP56
SP56 = OFFSP56
6
0 6
until end of scanor next instructionthat uses SP56
Example of Execution
.
...
.
...
.
...
.
...
.
.
.
DL205 User Manual, 5th Edition, Rev. B 5-163
Chapter 5: Standard RLL Instructions
Remove from Table (RFT)The Remove From Table instruction pops a value off of a table and stores it in a V-memory location. When a value is removed from the table all other values are shifted up 1 location. The first V-memory location in the table contains the table length counter. The table counter decrements by 1 each time the instruction is executed. If the length counter is 0 or greater than the maximum table length (specified in the first level of the accumulator stack), the instruction will not execute and SP56 will be on.
The instruction will be executed once per scan provided the input remains on. The function parameters are loaded into the first level of the accumulator stack and the accumulator by 2 additional instructions. Listed below are the steps necessary to program the Remove From Table function.
Step 1: Load the length of the table (number of V-memory locations) into the first level of the accumulator stack. This parameter must be a HEX value, 0 to FF.
Step 2: Load the starting V-memory location for the table into the accumulator. (Remember, the starting location of the table is used as the table length counter.) This parameter must be a HEX value.
Step 3: Insert the RFT instructions which specifies destination V-memory location (Vaaa). This is where the value will be moved to.
Helpful hint: For parameters that require HEX values when referencing memory locations, the LDA instruction can be used to convert an octal address to the HEX equivalent and load the value into the accumulator.
Helpful hint: The instruction will be executed every scan if the input logic is on. If you do not want the instruction to execute for more than one scan, a one shot (PD) should be used in the input logic.
Helpful hint: The table counter value should be set to indicate the starting point for the operation. Also, it must be set to a value that is within the length of the table. For example, if the table is 6 words long, then the allowable range of values that could be in the table counter should be between 1 and 6. If the value is outside of this range or 0, the data will not be moved from the table. Also, a one shot (PD) should be used so the value will only be set in one scan and will not affect the instruction operation.
NOTE: Status flags (SPs) are only valid until: — another instruction that uses the same flag is executed, or — the end of the scan The pointer for this instruction can be set to start anywhere in the table. It is not set automatically. You have to load a value into the pointer somewhere in your program.
aaaVR F T�
����
230
240
250-1
260
262
Discrete Bit Flags Description SP56 On when the table counter equals 0.
Operand Data Type Range D2-260/D2-262
aaaV-memory V All (See page 3-57)
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B5-164
Chapter 5: Standard RLL Instructions
In the following example, when X1 is on, the constant value (K6) is loaded into the accumulator using the Load instruction. This value specifies the length of the table and is placed in the first stack location after the Load Address instruction is executed. The octal address 1400 (V1400) is the starting location for the source table and is loaded into the accumulator. The destination location (V1500) is specified in the Remove from Table instruction. The table counter will be decreased by “1” after the instruction is executed.
Since the table counter specifies the range of data that will be removed from the table, it is important to understand how the table locations are numbered. If you examine the example table, you’ll notice that the data locations are numbered from the top of the table. For example, if the table counter started at 6, then all 6 of the locations would be affected during the instruction execution.
Also, our example uses a normal input contact (X1) to control the execution. Since the CPU scan is extremely fast, and the pointer decrements automatically, the data would be removed from the table very quickly. If this is a problem for your application, you have the option of using a one-shot (PD) to remove one value each time the input contact transitions from low to high.
DirectSOFT
LDK6
X1 Load the constant value 6(Hex.) into the lower 16 bitsof the accumulator
LDAO 1400
RFTV1500
Copy the specified valuefrom the table to thespecified location (V1500)
Convert octal 1400 to HEX300 and load the value intothe accumulator
Handheld Programmer Keystrokes
STR$
SHFT ANDSTL
3D
SHFT ORNR
5F
MLRT
PREV
1B ENT
6G
0A
0A
ENT
SHFT ANDSTL
3D
1B
4E
0A ENT
0A
1B
5F
0A ENT
V1401 0 5 0 0
V1402 9 9 9 9
V1403 3 0 7 4
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
SS
V1500X X X X
1
2
3
4
5
6
Destination
V14000 0 0 6
Table C ounterTable
DirectSOFT (optional one-shot method)
LDK6
C0
X1 C0PD
Load the constant value 6(HEX) into the lower 16 bitsof the accumulator
LDAO 1400
Convert octal 1400 to HEX300 and load the value intothe accumulator. This is thetable pointer location.
DL205 User Manual, 5th Edition, Rev. B 5-165
Chapter 5: Standard RLL Instructions
The following diagram shows the scan-by-scan results of the execution for our example program. In our example we’re showing the table counter set to 4 initially (Remember, you can set the table counter to any value that is within the range of the table). The table counter automatically decrements from 4 to 0 as the instruction is executed. Notice how the last 2 table positions, 5 and 6, are not moved up through the table. Also, notice how SP56, which comes on when the table counter is 0, is only on until the end of the scan.
V1401 8 9 8 9
V1402 8 9 8 9
V1403 8 9 8 9
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
V1401 8 9 8 9
V1402 8 9 8 9
V1403 8 9 8 9
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
V1401 8 9 8 9
V1402 8 9 8 9
V1403 8 9 8 9
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
V1401 4 0 7 9
V1402 8 9 8 9
V1403 8 9 8 9
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
V1401 9 9 9 9
V1402 4 0 7 9
V1403 8 9 8 9
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
1
2
3
4
5
6
1
2
3
4
5
6
V1401 0 5 0 0
V1402 9 9 9 9
V1403 3 0 7 4
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
V1500X X X X
1
2
3
4
5
6
V14000 0 0 4 V1401 9 9 9 9
V1402 4 0 7 9
V1403 8 9 8 9
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
V15000 5 0 0
Destination
V14000 0 0 3
V15009 9 9 9
Destination
V14000 0 0 2
V15004 0 7 9
V14000 0 0 1
V15000 5 0 0
1
2
3
4
5
6
V14000 0 0 3
V15009 9 9 9
1
2
3
4
5
6
V14000 0 0 2
SP56 = OFFSP56
SP56 = OFFSP56
SP56 = OFFSP56
V15008 9 8 9
V14000 0 0 0
V15004 0 7 9
1
2
3
4
5
6
V14000 0 0 1
SP56
SP56 = OFFSP56
SP56 = OFFSP56
SP56 = OFFSP56
SP56 = OFFSP56
Table Counter(Automatically d ecremented)
V1401 4 0 7 9
V1402 8 9 8 9
V1403 8 9 8 9
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
1
2
3
4
5
6
05
00
99
99
40
79
1
2
3
4
5
6
89
89
Before RFT Execution
Table Table Counter
Destination
Table Counterindicates thatthese 4positions willbe used
After RFT Execution
Table
Before RFT Execution
Table
After RFT Execution
Table
Before RFT Execution
Table
After RFT Execution
Table
Before RFT Execution
Table
After RFT Execution
Table
Table Counter
Table Counter
Table Counter
Destinatio
Destination
Destination
Start here
Start here
Start here
Start here
Scan N+3
Scan N+2
Scan N+1
Scan N
Destination
Destination
SP56 = ONuntil end of scanor next instructionthat uses SP56
Table Counter(Automatically decremented)
Table Counter(Automatically decremented)
Table Counter(Automatically decremented)
DL205 User Manual, 5th Edition, Rev. B5-166
Chapter 5: Standard RLL Instructions
Add to Top (ATT)The Add To Top instruction pushes a value onto a V-memory table from a V-memory location. When the value is added to the table, all other values are pushed down 1 location.
The instruction will be executed once per scan provided the input remains on. The function parameters are loaded into the first level of the accumulator stack and the accumulator by 2 additional instructions. Listed below are the steps necessary to program the Add To Top function.
Step 1: Load the length of the table (number of V-memory locations) into the first level of the accumulator stack. This parameter must be a HEX value, 0 to FF.
Step 2: Load the starting V-memory location for the table into the accumulator. (Remember, the starting location of the table is used as the table length counter.) This parameter must be a HEX value.
Step 3: Insert the ATT instruction that specifies the source V-memory location (Vaaa). This is where the value will be moved from.
Helpful hint: For parameters that require HEX values when referencing memory locations, the LDA instruction can be used to convert an octal address to the HEX equivalent and load the value into the accumulator.
Helpful hint: The instruction will be executed every scan if the input logic is on. If you do not want the instruction to execute for more than one scan, a one shot (PD) should be used in the input logic.
Helpful hint: The table counter value should be set to indicate the starting point for the operation. Also, it must be set to a value that is within the length of the table. For example, if the table is 6 words long, then the allowable range of values that could be in the table counter should be between 1 and 6. If the value is outside of this range or zero, the data will not be moved into the table. Also, a one shot (PD) should be used so the value will only be set in one scan and will not affect the instruction operation.
NOTE: Status flags (SPs) are only valid until: — another instruction that uses the same flag is executed, or — the end of the scan The pointer for this instruction can be set to start anywhere in the table. It is not set automatically. You have to load a value into the pointer somewhere in your program.
ATTV aaa�
����
230
240
250-1
260
262
Discrete Bit Flags Description SP56 On when the table counter equals 0.
Operand Data Type Range D2-260/D2-262
aaaV-memory V All (See page 3-57)
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-167
Chapter 5: Standard RLL Instructions
In the following example, when X1 is on, the constant value (K6) is loaded into the accumulator using the Load instruction. This value specifies the length of the table and is placed in the first stack location after the Load Address instruction is executed. The octal address 1400 (V1400), which is the starting location for the destination table and table counter, is loaded into the accumulator. The source location (V1500) is specified in the Add to Top instruction. The table counter will be increased by “1” after the instruction is executed.
For the ATT instruction, the table counter determines the number of additions that can be made before the instruction will stop executing. So, it is helpful to understand how the system uses this counter to control the execution.
For example, if the table counter was set to 2, and the table length was 6 words, then there could only be 4 additions of data before the execution was stopped. This can be calculated easily by:
Table length – table counter = number of executions
Also, our example uses a normal input contact (X1) to control the execution. Since the CPU scan is extremely fast, and the table counter increments automatically, the data would be moved into the table very quickly. If this is a problem for your application, you have an option of using a one-shot (PD) to add one value each time the input contact transitions from low to high.
DirectSOFT
LDK6
X1
Load the constant value 6(Hex.) into the lower 16 bitsof the accumulator
LDAO 1400
ATTV1500
Copy the specified valuefrom V1500 to the table
Convert octal 1400 to HEX300 and load the value intothe accumulator
Handheld Programmer Keystrokes
STR$
SHFT ANDSTL
3D
SHFT 0A
MLRT
MLRT
PREV
1B ENT
6G
0A
0A
ENT
SHFT ANDSTL
3D
1B
4E
0A ENT
0A
1B
5F
0A ENT
V1401 0 5 0 0
V1402 9 9 9 9
V1403 3 0 7 4
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
V1500X X X X
1
2
3
4
5
6
Data Source
V14000 0 0 2
Table CounterTable
( e .g .: 6 -- 2 = 4 )
DirectSOFT (optional one-shot method)
LDK6
C0
X1 C0PD
Load the constant value 6(HEX) into the lower 16 bitsof the accumulator
LDAO 1400
Convert octal 1400 to HEX300 and load the value intothe accumulator. This is thestarting table location.
DL205 User Manual, 5th Edition, Rev. B5-168
Chapter 5: Standard RLL Instructions
The following diagram shows the scan-by-scan results of the execution for our example program. The table counter is set to 2 initially, and it will automatically increment from 2 to 6 as the instruction is executed. Notice how SP56 comes on when the table counter is 6, which is equal to the table length. Plus, although our example does not show it, we are assuming that there is another part of the program that changes the value in V1500 (data source) prior to the execution of the ATT instruction.
V1401 7 7 7 7
V1402 4 3 4 3
V1403 5 6 7 8
V1404 1 2 3 4
V1405 0 5 0 0
V1406 9 9 9 9
V1407 X X X X
1
2
3
4
5
6
77
77
V1401 4 3 4 3
V1402 5 6 7 8
V1403 1 2 3 4
V1404 0 5 0 0
V1405 9 9 9 9
V1406 3 0 7 4
V1407 X X X X
V1401 4 3 4 3
V1402 5 6 7 8
V1403 1 2 3 4
V1404 0 5 0 0
V1405 9 9 9 9
V1406 3 0 7 4
V1407 X X X X
1
2
3
4
5
6
V1401 5 6 7 8
V1402 1 2 3 4
V1403 0 5 0 0
V1404 9 9 9 9
V1405 3 0 7 4
V1406 8 9 8 9
V1407 X X X X
V1401 5 6 7 8
V1402 1 2 3 4
V1403 0 5 0 0
V1404 9 9 9 9
V1405 3 0 7 4
V1406 8 9 8 9
V1407 X X X X
V1401 1 2 3 4
V1402 0 5 0 0
V1403 9 9 9 9
V1404 3 0 7 4
V1405 8 9 8 9
V1406 1 0 1 0
V1407 X X X X
1
2
3
4
5
6
V1401 0 5 0 0
V1402 9 9 9 9
V1403 3 0 7 4
V1404 8 9 8 9
V1405 1 0 1 0
V1406 2 0 4 6
V1407 X X X X
V15001 2 3 4
1
2
3
4
5
6
V14000 0 0 2 V1401 1 2 3 4
V1402 0 5 0 0
V1403 9 9 9 9
V1404 3 0 7 4
V1405 8 9 8 9
V1406 1 0 1 0
V1407 X X X X
V15001 2 3 4
V14000 0 0 3
Table
V15005 6 7 8
Data Source
V14000 0 0 4
V15004 3 4 3
V14000 0 0 5
V15005 6 7 8
1
2
3
4
5
6
V14000 0 0 3
V15004 3 3 4
1
2
3
4
5
6
V14000 0 0 4
SP56 = OFF SP56
SP56 = OFF SP56
SP56 =SP56
V15007 7 7 7
V14000 0 0 6
V15007 7 7 7
1
2
3
4
5
6
V14000 0 0 5
SP56 =SP56
SP56 = OFF SP56
SP56 = OFF SP56
SP56 = OFF SP56
SP56 = OFFSP56
12
34
1
2
3
4
5
6
56
78
3074
8989
2046
1010Discard Bucket
Discard Bucket
34
3
4
Table
After ATT Execution Table counter
(Automatically Incremented)
Data Source
Discard Bucket
OFF
Discard Bucket
Data Source
ONuntil end of scanor next instructionthat uses SP56
Table counter
(Automatically Incremented)
Table counter (Automatically Incremented)
Table counter(Automatically Incremented)
Data Source
After ATT Execution
After ATT Execution
Table
After ATT Execution
Table
Before ATT Execution
Table
Before ATT Execution
Table
Before ATT Execution
Table
Before ATT Execution
Table Table counter
Data Source
Table counter
Data Source
Table counter
Data Source
Data Source
Table counter
Example of Execution
Scan N
Scan N+1
Scan N+2
Scan N+3
DL205 User Manual, 5th Edition, Rev. B 5-169
Chapter 5: Standard RLL Instructions
Table Shift Left (TSHFL)The Table Shift Left instruction shifts all the bits in a V-memory table to the left a specified number of bit positions.
Table Shift Right (TSHFR)The Table Shift Right instruction shifts all the bits in a V-memory table to the right a specified number of bit positions.
The following description applies to both the Table Shift Left and Table Shift Right instructions. A table is a range of V-memory locations. The Table Shift Left and Table Shift Right instructions shift bits serially throughout the entire table. Bits are shifted out the end of one word and into the opposite end of an adjacent word. At the ends of the table, bits are either discarded, or zeros are shifted into the table. The example tables below are arbitrarily four words long.
Step 1: Load the length of the table (number of V-memory locations) into the first level of the accumulator stack. This parameter must be a HEX value, 0 to FF.
Step 2: Load the starting V-memory location for the table into the accumulator. This parameter must be a HEX value. You can use the LDA instruction to convert an octal address to hex.
Step 3: Insert the Table Shift Left or Table Shift Right instruction. This specifies the number of bit positions you wish to shift the entire table. The number of bit positions must be in octal.
Helpful hint: Remember that each V-memory location contains 16 bits. The bits of the first word of the table are numbered from 0 to 17 octal. If you want to shift the entire table by 20 bits, that is 24 octal. Flag 53 will be set if the number of bits to be shifted is larger than the total bits contained within the table. Flag 67 will be set if the last bit shifted (just before it is discarded) is a “1”.
VaaaTSHFL�
����
230
240
250-1
260
262
VaaaTSHFR
Table Shift LeftTable Shift Right
Discard Bits
Shift in zerosDiscard Bits
V - xxxx + 2
V - xxxx + 1
V - xxxxShift in zeros
Operand Data Type Range D2-260/D2-262
aaaV-memory V All (See page 3-57)
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B5-170
Chapter 5: Standard RLL Instructions
NOTE: Status flags are only valid until: — the end of the scan — or another instruction that uses the same flag is executed.
The example table to the right contains BCD data as shown (for demonstration purposes). Suppose we want to do a table shift right by 3 BCD digits (12 bits). Converting to octal, 12 bits is 14 octal. Using the Table Shift Right instruction and specifying a shift by octal 14, we have the resulting table shown at the far right. Notice that the 2–3–4 sequence has been discarded, and the 0–0–0 sequence has been shifted in at the bottom.
The following ladder example assumes the data at V3000 to V3004 already exists as shown above. We will use input X0 to trigger the Table Shift Right operation. First, we will load the table length (5 words) into the accumulator stack. Next, we load the starting address into the accumulator. Since V3000 is an octal number we have to convert it to hex by using the LDA command. Finally, we use the Table Shift Right instruction and specify the number of bits to be shifted (12 decimal), which is 14 octal.
1 2 3 4
5 6 7 8
1 1 2 2
3 3 4 4
6 7 8 1
1 2 2 5
3 4 4 1
5 6 6 3
5 5 6 6 0 0 0 5
V 3000 V 3000
Discrete Bit Flags Description
SP53 On when the number of bits to be shifted is larger than the total bits contained within the table
SP67 On when the last bit shifted (just before it is discarded) is a “1”
DirectSOFT
LDK5
X0 Load the constant value 5(Hex.) into the lower 16 bitsof the accumulator.
LDAO 3000
TSHFRO 14
Do a table shift right by 12bits, which is 14 octal.
Convert octal 3000 to HEXand load the value into theaccumulator. This is thetable beginning.
Handheld Programmer Keystrokes
STR$
SHFT ANDSTL
3D
SHFT MLRT
RSTS
7H
PREV
0A ENT
5F
0A
0A
ENT
SHFT ANDSTL
3D
3D
0A
0A ENT
1B
4E ENTSHFT 5
FORN
R NEXT
DL205 User Manual, 5th Edition, Rev. B 5-171
Chapter 5: Standard RLL Instructions
AND Move (ANDMOV)The AND Move instruction copies data from a table to the specified memory location, ANDing each word with the accumulator data as it is written.
OR Move (ORMOV)The Or Move instruction copies data from a table to the specified memory location, ORing each word with the accumulator contents as it is written.
Exclusive OR Move (XORMOV)The Exclusive OR Move instruction copies data from a table to the specified memory location, XORing each word with the accumulator value as it is written.
The following description applies to the AND Move, OR Move, and Exclusive OR Move instructions. A table is just a range of V-memory locations. These instructions copy the data of a table to another specified location, preforming a logical operation on each word with the accumulator contents as the new table is written.
Step 1: Load the length of the table (number of V-memory locations) into the first level of the accumulator stack. This parameter must be a HEX value, 0 to FF.
Step 2: Load the starting V-memory location for the table into the accumulator. This parameter must be a HEX value. You can use the LDA instruction to convert an octal address to hex.
Step 3: Load the BCD/hex bit pattern into the accumulator which will be logically combined with the table contents as they are copied.
Step 4: Insert the AND Move, OR Move, or XOR Move instruction. This specifies the starting location of the copy of the original table. This new table will automatically be the same length as the original table.
The example table to the right contains BCD data as shown (for demonstration purposes). Suppose we want to move a table of two words at V3000 and AND it with K6666. The copy of the table at V3100 shows the result of the AND operation for each word.
The program on the next page performs the ANDMOV operation example above. It assumes that the data in the table at V3000 – V3001 already exists. First we load the table length (two words) into the accumulator. Next we load the starting address of the source table, using the LDA instruction. Then we load the data into the accumulator to be ANDed with the table. In the ANDMOV command, we specify the table destination, V3100.
VaaaANDMOV
VaaaORMOV
�����
230
240
250-1
260
262
VaaaXORMOV
3 3 3 3
F F F F
2 2 2 2
6 6 6 6
V 3000 V 3100ANDMOV
K 6666
�����
230
240
250-1
260
262
DS UsedHPP Used
Operand Data Type Range D2-260/D2-262
aaaV-memory V All (See page 3-57)
DL205 User Manual, 5th Edition, Rev. B5-172
Chapter 5: Standard RLL Instructions
The example to the right shows a table of two words at V3000 and logically ORs it with K8888. The copy of the table at V3100 shows the result of the OR operation for each word.
The program to the right performs the ORMOV example above. It assumes that the data in the table at V3000 – V3001 already exists. First we load the table length (two words) into the accumulator. Next we load the starting address of the source table, using the LDA instruction. Then we load the data into the accumulator to be ORed with the table. In the ORMOV command, we specify the table destination, V3100.
The example to the right shows a table of two words at V3000 and logical XORs it with K3333. The copy of the table at V3100 shows the result of the XOR operation for each word.
The ladder program example for the XORMOV is similar to the one above for the ORMOV. Just use the XORMOV instruction. On the Handheld Programmer, you must use the SHFT key and spell “XORMOV” explicitly.
1 1 1 1
1 1 1 1
9 9 9 9
9 9 9 9
V 3000 V 3100OR MOV
K 8888
Handheld Programmer Keystrokes
STR$
SHFTANDSTL
3D
ORSTM
INST#O
PREV
0A ENT
2C
0A
0A
ENT
SHFTANDSTL
3D
3D
0A
0A ENT
SHFTANDSTL
3D PREV
8I ENT
8I
8I
8I
ORQ
3DSHFT
ANDV
1B
0A
0A ENT
1 1 1 1
1 1 1 1
2 2 2 2
2 2 2 2
V 3000 V 3100X OR MOV
K 3333
X0
DirectSOFT 32
LD
K2
LDA
0 3000
LD
K8888
ORMOV
0 3100
Load the constant value 2(Hex) into the lower 16 bits of the accumulator.
Convert octal 3000 to HEXand load the value into theaccumulator. This is the table beginning.
Load the constant value8888 (Hex.) into the lower16 bits of the accumulator.
Copy the table to V3100,ORing its contents with the accumulator as it is written.
Handheld Programmer Keystrokes
STR$
SHFTANDSTL
3D
ORSTM
INST#O
PREV
0A ENT
2C
0A
0A
ENT
SHFTANDSTL
3D
3D
0A
0A ENT
SHFTANDSTL
3D PREV
6G ENT
6G
6G
6G
ANDV
3DSHFT
ANDV
1B
0A
0A ENT
LD K2
X0
DirectSOFT
Load the constant value 2(Hex.) into the lower 16bits of the accumulator.
Convert otal 3000 to HEXand load the value into the accumulator. This is thetable beginning.
Load the constant value6666 (Hex.) into the lower16 bits of the accumulator.
Copy the table to V3100,ANDing its contents with theaccumulator as it is written.
LDA
0 3000
LDK6666
ANDMOV0 3100
DL205 User Manual, 5th Edition, Rev. B 5-173
Chapter 5: Standard RLL Instructions
Find Block (FINDB)The Find Block instruction searches for an occurrence of a specified block of values in a V-memory table. The function parameters are loaded into the first and second levels of the accumulator stack and the accumulator by three additional instructions. If the block is found, its starting address will be stored in the accumulator. If the block is not found, flag SP53 will be set.
The steps below are necessary to program the Find Block function.Step 1: Load the number of bytes in the block to be located. This parameter must be a
decimal value from 1 to 256.Step 2: Load the length of a table (number of words) to be searched. The Find Block will
search multiple tables that are adjacent in V-memory. This parameter must be a decimal value from 1 to 128.
Step 3: Load the ending location for all the tables into the accumulator. This parameter must be a HEX value. You can use the LDA instruction to convert an octal address to hex.
Step 4: Load the table starting location for all the tables into the accumulator. This parameter must be a HEX value. You can use the LDA instruction to convert an octal address to hex.
Step 5: Insert the Find Block instruction. This specifies the starting location of the block of data you are trying to locate.
FINDBAaaa
�����
230
240
250-1
260
262
Discrete Bit Flags Description SP53 On when the Find Block instruction was executed but did not
find the block of data in table specified.
Operand Data Type Range D2-260/D2-262
A aaaV-memory V All (See page 3 - 56)V-memory P All (See page 3 - 56)
Table 1
Table 2
Table 3
Table 32
Block
Start Addr.
End Addr.
32 bytes
Start Addr.
16 words
16 words
16 words
16 words
�
�
�
V2000
V2017V2020
V2037V2040
V2057
V2760
V2777
V3000
V3017
X1LD
K32
LDK16
LDAO2777
LDAO2000
FINDBV3000
END
Sample Program of FINDB
DS UsedHPP N/A
DL205 User Manual, 5th Edition, Rev. B5-174
Chapter 5: Standard RLL Instructions
Swap (SWAP)The Swap instruction exchanges the data in two tables of equal length.
The following steps apply to both the Set Bit and Reset Bit table instructions.
Step 1: Load the length of the tables (number of V-memory locations) into the first level of the accumulator stack. This parameter must be a HEX value, 0 to FF. Remember that the tables must be of equal length.
Step 2: Load the starting V-memory location for the first table into the accumulator. This parameter must be a HEX value. You can use the LDA instruction to convert an octal address to hex.
Step 3: Insert the Swap instruction. This specifies the starting address of the second table.
Helpful hint: The data swap occurs within a single scan. If the instruction executes on multiple consecutive scans, it will be difficult to know the actual contents of either table at any particular time. So, remember to swap just on a single scan.
The example to the right shows a table of two words at V3000. We will swap its contents with another table of two words at V3100 by using the Swap instruction.
The example program below uses a PD contact (triggers for one scan for off-to-on transition). First, we load the length of the tables (two words) into the accumulator. Then we load the address of the first table (V3000) into the accumulator using the LDA instruction, converting the octal address to hex. Note that it does not matter which table we declare “first,” because the swap results will be the same.
VaaaSWAP�
����
230
240
250-1
260
262
DirectSOFT
LDK2
X0 Load the constant value 2(Hex.) into the lower 16 bitsof the accumulator.
LDAO 3000
SWAPV 3100
Swap the contents of thetable in the previousinstruction with the one atV3100.
Convert octal 3000 to HEXand load the value into theaccumulator. This is thetable beginning.
Handheld Programmer Keystrokes
STR$
SHFT ANDSTL
3D
SHFT RSTS
ANDNW
0A
PREV
CVP ENT
2C
0A
0A
ENT
SHFT ANDSTL
3D
3D
0A
0A ENT
SHFT CVP
SHFT 3D
0A
0A
3D
1B
0A ENT
1 2 3 4
5 6 7 8
A B C D
0 0 0 0
V 3000 V 3100
S WAP
Operand Data Type Range D2-260/D2-262
aaaV-memory V All (See page 3-57)
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-175
Chapter 5: Standard RLL Instructions
Clock/Calendar InstructionsDate (DATE)
The Date instruction can be used to set the date in the CPU. The instruction requires two consecutive V-memory locations (Vaaa) to set the date. If the values in the specified locations are not valid, the date will not be set. The current date can be read from 4 consecutive V-memory locations (V7771–V7774).
In the following example, when C0 is on, the constant value (K94010301) is loaded into the accumulator using the Load Double instruction (C0 should be a contact from a one shot (PD) instruction). The value in the accumulator is output to V2000 using the Out Double instruction. The Date instruction uses the value in V2000 to set the date in the CPU.
DATEV aaa
Operand Data TypeRange
D2-250-1 D2-260/D2-262aaa aaa
V-memory V All (See page 3-56) All (See page 3-57)
230
240
250-1
260
262
�����
Date Range V-memory Location (BCD) (READ Only)
Year 0-99 V7774Month 1-12 V7773Day 1-31 V7772Day of Week 0-06 V7771
The values entered for the day of week are: 0=Sunday, 1=Monday, 2=Tuesday, 3=Wednesday, 4=Thursday, 5=Friday, 6=Saturday.
V2000
Acc.
0 3 0 1
0 3 0 1
9 4 0 1 0 3 0 1
9 4 0 1
V2001
9 4 0 1
Acc. 9 4 0 1 0 3 0 1
0 3 0 19 4 0 1
V2001 V2000
DirectSOFT
C0 LDD
K94010301
OUTD
V2000
DATE
V2000
Constant (K)
In this example, the Dateinstruction uses the value set inV2000 and V2001 to set the date in the appropriate V memory locations (V7771-V7774).
Format
Year Month Day Day of WeekHandheld Programmer Keystrokes
0A ENT
1B
4E
0A
0A
ENT
STR$
SHFT ANDSTL
3D
SHFT MLRT
3D
OUTGX SHFT 3
D
NEXT NEXT NEXT NEXT
2C ENT
PREV
0A
9J
0A
3D
1B
0A ENT
0A
3D
0A
4E
0A
2C ENT0
A0
A
Load the constantvalue (K94010301)into the accumulator
Copy the value in the accumulator to V2000 and V2001
Set the date in the CPU using the value in V2000 and 2001
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B5-176
Chapter 5: Standard RLL Instructions
Time (TIME)The Time instruction can be used to set the time (24-hour clock) in the CPU. The instruction requires two consecutive V-memory locations (Vaaa) which are used to set the time. If the values in the specified locations are not valid, the time will not be set. The current time can be read from memory locations V7747 and V7766–V7770.
In the following example, when C0 is on, the constant value (K73000) is loaded into the accumulator using the Load Double instruction (C0 should be a contact from a one shot (PD) instruction). The value in the accumulator is output to V2000 using the Out Double instruction. The Time instruction uses the value in V2000 to set the time in the CPU.
TIMEV aaa
230
240
250-1
260
262
�����
Date Range V-memory Location (BCD) (READ Only)
1/100 seconds (10ms) 0-99 V7747Seconds 0-59 V7766Minutes 0-59 V7767Hour 0-23 V7770
Sta
ndar
dR
LL In
stru
ctio
ns
DirectSOFT
Handheld Programmer Keystrokes
LDDK73000
C0
Load the constantvalue (K73000) intothe accumulator
TIMEV2000
Set the time in the CPUusing the value in V2000and V2001
OUTDV2000
Copy the value in theaccumulator to V2000and V2001 V2000
Acc.
3 0 0 0
3 0 0 0
0 0 0 7 3 0 0 0
0 0 0 7
V2001
0 0 0 7
Constant (K)
Acc. 0 0 0 7 3 0 0 0
The Time instruction uses thevalue set in V2000 and V2001 toset the time in the appropriate V-memory locations (V7766–V7770)
Minutes SecondsNotUsed
Hour
3 0 0 00 0 0 7V2001 V2000
Format
0A ENT
7H
0A
0A
ENT
STR$
SHFT ANDSTL
3D
SHFT MLRT
3D
OUTGX SHFT 3
D
NEXT NEXT NEXT NEXT
2C ENT
PREV
0A
3D
0A
ORSTM
8I
4E
0A
2C ENT0
A0
A
0A
0A
SHFT
DS UsedHPP Used
Operand Data TypeRange
D2-250-1 D2-260/D2-262aaa aaa
V-memory V All (See page 3-56) All (See page 3-57)
DL205 User Manual, 5th Edition, Rev. B 5-177
Chapter 5: Standard RLL Instructions
CPU Control InstructionsNo Operation (NOP)
The No Operation is an empty (not programmed) memory location.
End (END)The End instruction marks the termination point of the normal program scan. An End instruction is required at the end of the main program body. If the End instruction is omitted, an error will occur and the CPU will not enter the Run Mode. Data labels, subroutines and interrupt routines are placed after the End instruction. The End instruction is not conditional; therefore, no input contact is allowed.
Stop (STOP)The Stop instruction changes the operational mode of the CPU from Run to Program (Stop) mode. This instruction is typically used to stop PLC operation in a shutdown condition such as an I/O module failure.
In the following example, when SP45 comes on indicating an I/O module failure, the CPU will stop operation and switch to the program mode.
NOP
DirectSOFT Handheld Programmer Keystrokes
NOPSHFT TMR
NINST#O
CVP ENT
END
DirectSOFT Handheld Programmer Keystrokes
ENDSHFT 4
ETMR
N3
D ENT
STOP�����
230
240
250-1
260
262
DirectSOFT Handheld Programmer Keystrokes
STOP
SP45STR
$ SHFT ENTSTRNSP
4E
SHFT RSTS
MLRT
INST#O
CVP ENTSHFT
5F
SP45 will turn onif there is an I/Omodule failure.
DS UsedHPP Used
DS UsedHPP Used
DS UsedHPP Used
�����
230
240
250-1
260
262
�����
230
240
250-1
260
262
DL205 User Manual, 5th Edition, Rev. B5-178
Chapter 5: Standard RLL Instructions
Reset Watch Dog Timer (RSTWT)The Reset Watch Dog Timer instruction resets the CPU scan timer. The default setting for the watch dog timer is 200ms. Scan times very seldom exceed 200ms, but it is possible. For/next loops, subroutines, interrupt routines, and table instructions can be programmed such that the scan becomes longer than 200ms. When instructions are used in a manner that could exceed the watch dog timer setting, this instruction can be used to reset the timer.
A software timeout error (E003) will occur and the CPU will enter the program mode if the scan time exceeds the watch dog timer setting. Placement of the RSTWT instruction in the program is very important. The instruction has to be executed before the scan time exceeds the watch dog timer’s setting.
If the scan time is consistently longer than the watch dog timer’s setting, the timeout value may be permanently increased from the default value of 200ms by AUX 55 on the HPP or the appropriate auxiliary function in your programming package. This eliminates the need for the RSTWT instruction.
In the following example, the CPU scan timer will be reset to 0 when the RSTWT instruction is executed. See the For/Next instruction for a detailed example.
RSTWT230
240
250-1
260
262
�����
DirectSOFT Handheld Programmer Keystrokes
RSTWT
SHFT ORNR
RSTS
MLRT
ANDNW
MLRT ENT
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-179
Chapter 5: Standard RLL Instructions
Program Control InstructionsGoto Label (GOTO) (LBL)
The Goto / Label skips all instructions between the Goto and the corresponding LBL instruction. The operand value for the Goto and the corresponding LBL instruction is the same. The logic between Goto and LBL instruction is not executed when the Goto instruction is enabled. Up to 128 Goto instructions and 64 LBL instructions can be used in the program.
In the following example, when C7 is on, all the program logic between the GOTO and the corresponding LBL instruction (designated with the same constant Kaaa value) will be skipped. The instructions being skipped will not be executed by the CPU.
K aaa
GOTO230
240
250-1
260
262
�����
K aaaLBL K aaaLBL
Operand Data TypeRange
D2-240 D2-250-1 D2-260/D2-262aaa aaa aaa
Constant K 1-FFFF 1-FFFF 1-FFFF
Handheld Programmer Keystrokes
LBL K5
C7 K5
GOTO
X1 C2
OUT
X5 Y2
OUT
STR$ SHFT 2
C ENT7H
SHFT 6G
INST#O
MLRT
INST#O
5F
STR$
OUTGX SHFT 2
C2
C ENT
SHFT ANDSTL
1B
ANDSTL
5F ENT
STR$
OUTGX
1B ENT
ENT5F
2C ENT
ENT
DirectSOFT
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B5-180
Chapter 5: Standard RLL Instructions
For/Next (FOR) (NEXT)The For and Next instructions are used to execute a section of ladder logic between the For and Next instruction a specified numbers of times. When the For instruction is enabled, the program will loop the specified number of times. If the For instruction is not energized, the section of ladder logic between the For and Next instructions is not executed.
For/Next instructions cannot be nested. Up to 64 For/Next loops may be used in a program. If the maximum number of For/Next loops is exceeded, error E413 will occur.
The normal I/O update and CPU housekeeping is suspended while executing the For/Next loop. The program scan time can increase significantly, depending on the number of times the logic between the For and Next instruction is executed. With the exception of immediate I/O instructions, I/O will not be updated until the program execution is completed for that scan. Depending on the length of time required to complete the program execution, it may be necessary to reset the watchdog timer inside of the For/Next loop using the RSTWT instruction.
A aaaFOR
230
240
250-1
260
262
�����
NEXT
Operand Data TypeRange
D2-240 D2-250-1 D2-260/D2-262 A aaa aaa aaaV-memory V All (See page 3 - 54) All (See page 3 - 55) All (See page 3 - 56)Constant K 1-9999 1-9999 1-9999
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B 5-181
Chapter 5: Standard RLL Instructions
In the following example, when X1 is on, the application program inside the For/Next loop will be executed three times. If X1 is off, the program inside the loop will not be executed. The immediate instructions may or may not be necessary depending on your application. Also, The RSTWT instruction is not necessary if the For/Next loop does not extend the scan time larger the Watchdog Timer setting. For more information on the Watchdog Timer, refer to the RSTWT instruction.
X1DirectSOFT
Handheld Programmer Keystrokes
K3
FOR
RSTWT
X20 Y5
OUT
NEXT
1 2 3
STR$
SHFT 5F
INST#O
ORNR
SHFT ORNR
RSTS
MLRT
ANDNW
MLRT ENT
STR$ SHFT 8
I2
C0
A ENT
OUTGX
SHFT TMRN
4E
SETX
MLRT ENT
1B ENT
3D ENT
5F ENT
DL205 User Manual, 5th Edition, Rev. B5-182
Chapter 5: Standard RLL Instructions
Goto Subroutine (GTS) (SBR)The Goto Subroutine instruction allows a section of ladder logic to be placed outside the main body of the program and execute only when needed. There can be a maximum of 128 GTS instructions and 64 SBR instructions used in a program. The GTS instructions can be nested up to 8 levels. An error E412 will occur if the maximum limits are exceeded. Typically this will be used in an application where a block of program logic may be slow to execute and is not required to execute every scan. The subroutine label and all associated logic is placed after the End statement in the program. When the subroutine is called from the main program, the CPU will execute the subroutine (SBR) with the same constant number (K) as the GTS instruction that called the subroutine.
By placing code in a subroutine, it is only scanned and executed when needed since it resides after the End instruction. Code which is not scanned does not impact the overall scan time of the program.
Subroutine Return (RT)When a Subroutine Return is executed in the subroutine, the CPU will return to the point in the main body of the program from which it was called. The Subroutine Return is used as termination of the subroutine, which must be the last instruction in the subroutine and is a stand-alone instruction (no input contact on the rung).
Subroutine Return Conditional (RTC)The Subroutine Return Conditional instruction is an optional instruction used with an input contact to implement a conditional return from the subroutine. The Subroutine Return (RT) is still required for termination of the Subroutine.
K aaa
GTS230
240
250-1
260
262
�����
K aaaSBR
RT
230
240
250-1
260
262
�����
RTC230
240
250-1
260
262
�����
DS UsedHPP Used
DS UsedHPP Used
Operand Data TypeRange
D2-240 D2-250-1 D2-260/D2-262aaa aaa aaa
Constant K 1-FFFF 1-FFFF 1-FFFF
DL205 User Manual, 5th Edition, Rev. B 5-183
Chapter 5: Standard RLL Instructions
In the following example, when X1 is on, Subroutine K3 will be called. The CPU will jump to the Subroutine Label K3, and the ladder logic in the subroutine will be executed. If X35 is on, the CPU will return to the main program at the RTC instruction. If X35 is not on, Y0–Y17 will be reset to off and then the CPU will return to the main body of the program.
Standard R
LLInstructions
DirectSOFT
Handheld Programmer Keystrokes
SBR K3
X1 K3
GTS
END
Y5
OUTI
�
�
�
X20
Y10
OUTI
X21
X35
RTC
X35
RSTI
Y0 Y17
STR 1
SHFT G T S
E
SHFT S B R 1
STR SHFT I X 2 0
YOUT SHFT I 5
STR SHFT I X 2 1
YOUT SHFT I 1 0
STR SHFT I X 3 5
SHFT R T C
STRN SHFT I X 3 5
RST SHFT I Y 0 Y 1 7
SHFT R T
K 3
K 3
RT
K10LD
C0
ENT
ENT
ENT
ENT
ENT
ENT
ENT
ENT
ENT
ENT
ENT
ENT
ENT
SHFT N D
SHFT
��
�
DL205 User Manual, 5th Edition, Rev. B5-184
Chapter 5: Standard RLL Instructions
In the following example, when X1 is on, Subroutine K3 will be called. The CPU will jump to the Subroutine Label K3 and the ladder logic in the subroutine will be executed. The CPU will return to the main body of the program after the RT instruction is executed.
DirectSOFT
Handheld Programmer Keystrokes
SBR K3
X1 K3
GTS
END
Y5
OUT
X20
Y10
OUT
X21
RT
STR$
SHFT 6G
MLRT
RSTS
SHFT RSTS
1B
ORNR
STR$ SHFT 8
I2
C0
A ENT
OUTGX
STR$ SHFT 8
I2
C ENT1B
OUTGX
SHFT ORNR
MLRT ENT
SHFT 4E
TMRN
3D ENT
1B ENT
3D ENT
3D ENT
5F ENT
ENT1B
0A
SHFT
�
�
�
�
�
�
DL205 User Manual, 5th Edition, Rev. B 5-185
Chapter 5: Standard RLL Instructions
Master Line Set (MLS)The Master Line Set instruction allows the program to control sections of ladder logic by forming a new power rail controlled by the main left power rail. The main left rail is always master line 0. When an MLS K1 instruction is used, a new power rail is created at level 1. Master Line Sets and Master Line Resets can be used to nest power rails up to seven levels deep. Note that unlike stages in RLLPLUS, the logic within the master control relays is still scanned and updated even though it will not function if the MLS is off.
Master Line Reset (MLR)The Master Line Reset instruction marks the end of control for the corresponding MLS instruction. The MLR reference is one less than the corresponding MLS.
Understanding Master Control RelaysThe Master Line Set (MLS) and Master Line Reset (MLR) instructions allow you to quickly enable (or disable) sections of the RLL program. This provides program control flexibility. The following example shows how the MLS and MLR instructions operate by creating a sub power rail for control logic.
K aaa
MLS
Operand Data Type RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
aaa aaa aaa aaaConstant K 1-7 1-7 1-7 1-7
Operand Data Type RangeD2-230 D2-240 D2-250-1 D2-260/D2-262
aaa aaa aaa aaaConstant K 1-6 1-6 1-6 1-6
�����
230
240
250-1
260
262
K aaa
MLR
X0
X1
X2
OUTY7
X3
MLS
X10
K1
K2
K0
K1
MLS
OUT
MLR
MLR
OUT
Y10
Y11
DirectSOFT
When contact X0 is ON, logic under the first MLSwill be executed.
When contact X0 and X2 are ON, logic under thesecond MLS will be executed.
The MLR instructions note the end of the MasterControl area.
DS UsedHPP Used
�����
230
240
250-1
260
262
DL205 User Manual, 5th Edition, Rev. B5-186
Chapter 5: Standard RLL Instructions
MLS/MLR ExampleIn the following MLS/MLR example, logic between the first MLS K1 (A) and MLR K0 (B) will function only if input X0 is on. The logic between the MLS K2 (C) and MLR K1 (D) will function only if input X10 and X0 is on. The last rung is not controlled by either of the MLS coils.
K1
MLS
X0
C0
OUT
X1
C1
OUT
X2
Y0
OUT
X3
K2
MLS
X10
Y1
OUT
X5
Y2
OUT
X4
K1
MLR
C2
OUT
X5
Y3
OUT
X6
K0
MLR
Y4
OUT
X7
DirectSOFT Handheld Programmer Keystrokes
STR$ ENT0
A
MLSY
1B ENT
STR$
1B ENT
OUTGX SHFT ENT2
C0
A
STR$ ENT2
C
OUTGX SHFT ENT2
C1
B
STR$ ENT3
D
OUTGX ENT0
A
STR$ ENT0
A1
B
MLSY ENT2
C
STR$ ENT5
F
OUTGX ENT1
B
STR$ ENT
OUTGX ENT
4E
2C
MLRT
1B ENT
STR$ ENT5
F
OUTGX SHFT ENT2
C2
C
STR$ ENT
OUTGX ENT
6G
3D
MLRT ENT0
A
STR$ ENT
OUTGX
4E
7H
ENT
A
C
D
B
DL205 User Manual, 5th Edition, Rev. B 5-187
Chapter 5: Standard RLL Instructions
Interrupt InstructionsInterrupt (INT)
The Interrupt instruction allows a section of ladder logic to be placed outside the main body of the program and executed when needed. Interrupts can be called from the program or by external interrupts via the counter interface module (D2–CTRINT), which provides 4 interrupts.
The software interrupt uses interrupt #00 which means the hardware interrupt #0 and the software interrupt cannot be used together.
Typically, interrupts will be used in an application where a fast response to an input is needed or a program section needs to execute faster than the normal CPU scan. The interrupt label and all associated logic must be placed after the End statement in the program. When the interrupt routine is called from the interrupt module or software interrupt, the CPU will complete execution of the instruction it is currently processing in ladder logic, then execute the designated interrupt routine. Interrupt module interrupts are labeled in octal to correspond with the hardware input signal (X1 will initiate interrupt INT1). There is only one software interrupt, and it is labeled INT 0. The program execution will continue from the point it was before the interrupt occurred once the interrupt is serviced.
The software interrupt is set up by programming the interrupt time in V7634. The valid range is 3 to 999ms. The value must be a BCD value. The interrupt will not execute if the value is out of range.
NOTE: See the example program of a software interrupt.
O aaaINT
D2-240/D2-250-1/D2-260/D2-262*Software Hardware
Interrupt Input Interrupt Routine Interrupt Input Interrupt Routine
V7634 sets interrupt time INT 0 X0 (cannot be used along with s/w interrupt) INT 0
- - X1 INT 1- - X2 INT 2- - X3 INT 3
Operand Data Type RangeD2-240 D2-250-1 D2-260/D2-262*
aaa aaa aaaConstant 0 0-3 0-3 0-3
230
240
250-1
260
262
�����DS Used
HPP Used
* NOTE: D2-262 supports the Software Interrupt, INT 0, only.
DL205 User Manual, 5th Edition, Rev. B5-188
Chapter 5: Standard RLL Instructions
Interrupt Return (IRT)When an Interrupt Return is executed in the interrupt routine, the CPU will return to the point in the main body of the program from which it was called. The Interrupt Return is programmed as the last instruction in an interrupt routine and is a stand alone instruction (no input contact on the rung).
Interrupt Return Conditional (IRTC)The Interrupt Return Conditional instruction is a optional instruction used with an input contact to implement a conditional return from the interrupt routine. The Interrupt Return is required to terminate the interrupt routine.
Enable Interrupts (ENI)The Enable Interrupt instruction is programmed in the main body of the application program (before the End instruction) to enable hardware or software interrupts. Once the coil has been energized, interrupts will be enabled until they are disabled by the Disable Interrupt instruction.
Disable Interrupts (DISI)The Disable Interrupt instruction is programmed in the main body of the application program (before the End instruction) to disable both hardware or software interrupts. Once the coil has been energized, interrupts will be disabled until they are enabled by the Enable Interrupt instruction.
IRT
IRTC230
240
250-1
260
262
�����
ENI
DISI
DS UsedHPP Used
�����
230
240
250-1
260
262
�����
230
240
250-1
260
262
DL205 User Manual, 5th Edition, Rev. B 5-189
Chapter 5: Standard RLL Instructions
Interrupt Example for Interrupt Module In the following example, when X40 is on, the interrupts will be enabled. When X40 is off, the interrupts will be disabled. When an interrupt signal X1 is received, the CPU will jump to the interrupt label INT O 1. The application ladder logic in the interrupt routine will be performed. The CPU will return to the main body of the program after the IRT instruction is executed.
DirectSOFT
INT O 1
X40
ENI
DISI
X40
END
Y5
SETI
X20
Y10
SETI
X21
IRT
Handheld Programmer Keystrokes
8I
ORNR
MLRT
STR$ SHFT 8
I2
C0
A ENT
SHFT 8I
5F ENT
STR$ SHFT 8
I2
C ENT1B
SHFT 8I ENT1
B0
A
SHFT 4E
TMRN
3D ENT
STR$ ENT4
E0
A
SHFT 4E
TMRN
8I ENT
STRNSP ENT4
E0
A
SHFT 8I
TMRN
MLRT
1B ENT
SHFT ENT
SHFT ENT3D
8I
RSTS
8I
SETX
SETX
.
.
.
DL205 User Manual, 5th Edition, Rev. B5-190
Chapter 5: Standard RLL Instructions
Interrupt Example for Software InterruptIn the following example, when X1 is on, the value 10 is copied to V7634. This value sets the software interrupt to 10ms. When X20 turns on, the interrupt will be enabled. When X20 turns off, the interrupt will be disabled. Every 10ms the CPU will jump to the interrupt label INT O 0. The application ladder logic in the interrupt routine will be performed. If X35 is not on, Y0–Y17 will be reset to off and then the CPU will return to the main body of the program.
NOTE: Only one software interrupt is allowed and it must be Int0.Sta
ndar
d R
LLIn
stru
ctio
ns
DirectSOFT
INT O0
X20
ENI
DISI
X20
END
Y5
SETI
X20
X35
RSTI
Y0 Y17
IRT
Handheld Programmer Keystrokes
LDK104*
X1
Load the constant value(K10) into the lower 16 bitsof the accumulator *
OUTV7634
Copy the value in the lower16 bits of the accumulator toV7634
STR$
SHFT ANDSTL
3D SHFT 0
A
OUTGX SHFT AND
V ENT
JMPK
4B ENT
7H
6G
3D
4E
STR$
SHFT 4E
TMRN
8I ENT
STRNSP
SHFT ENT3D
8I
RSTS
8I
8I
ORNR
MLRT
STR$ SHFT 8
I2
C0
A ENT
SHFT 8I
5F ENT
SHFT 8I ENT
SHFT 8I ENT0
A
SHFT 4E
TMRN
3D ENT
SHFT 8I
TMRN
MLRT ENT
SHFT ENT
0A
1B ENT
ENT0A
ENT0A
2C
2C
1B
7H
3D
5F
SETX
RSTS
STRNSP
LDK40
SP0
OUTV7633
* The value entered, 3-999, must be followed by the digit 4 to complete the instruction.
.
.
.
SHFT STRNSP
SHFT 3D
6G
3D ENT
0A ENT
OUTGX V 7
H
SHFT 3D ENTJMP
K0
A4
EANDSTL SHFT 1
B
STR$
DL205 User Manual, 5th Edition, Rev. B 5-191
Chapter 5: Standard RLL Instructions
Intelligent I/O InstructionsRead from Intelligent Module (RD)
The Read from Intelligent Module instruction reads a block of data (1 to 128 bytes maximum) from an intelligent I/O module into the CPU’s V-memory. It loads the function parameters into the first and second level of the accumulator stack, and the accumulator by three additional instructions.
Listed below are the steps to program the Read from Intelligent module function.Step 1: Load the base number (0 to 3) into the first byte and the slot number (0 to 7) into the second
byte of the second level of the accumulator stack.
Step 2: Load the number of bytes to be transferred into the first level of the accumulator stack (maximum of 128 bytes).
Step 3: Load the address from which the data will be read into the accumulator. This parameter must be a HEX value.
Step 4: Insert the RD instruction that specifies the starting V-memory location (Vaaa) into which the data will be read.
Helpful hint: Use the LDA instruction to convert an octal address to its HEX equivalent and load it into the accumulator when the hex format is required.
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example, when X1 is on, the RD instruction will read six bytes of data from an intelligent module in base 1, slot 2 starting at address 0 in the intelligent module and copy the information into V-memory locations V1400–V1402.
Standard
RLL Instructions
V aaaRD
.
Discrete Bit Flags Description SP54 On when RX, WX, RD, WT instructions are executed with the wrong parameters.
Operand Data TypeRange
D2-230 D2-240 D2-250-1 D2-260/D2-262aaa aaa aaa aaa
V-memory V All (See page 3-54) All (See page 3-55) All (See page 3-56) All (See page 3-57)
DirectSOFT
Handheld Programmer Keystrokes
LDK0102
X1 The constant value K0102specifies the base number(01) and the base slotnumber (02)
LDK6
The constant value K6specifies the number ofbytes to be read
LDK0
The constant value K0specifies the starting addressin the intelligent module
RDV1400
V1400 is the starting locationin the CPU where thespecified data will be stored
V1401V1402V1403V1404
V1400 Data123456789001
Address 0Address 1Address 2Address 3Address 4Address 5
CPU Intelligent Module
1B ENT
0A
STR$
SHFT ANDSTL
3D
SHFT ORNR
PREV
4E
0A
1B
0A
2C ENT
6GSHFT ANDST
L3
D PREV ENT
0ASHFT ANDST
L3
D PREV ENT
3D
1B
0A ENT
3 14 27 58 60 91 0X XX XX XX X
DS UsedHPP Used
�����
230
240
250-1
260
262
DL205 User Manual, 5th Edition, Rev. B5-192
Chapter 5: Standard RLL Instructions
Write to Intelligent Module (WT)The Write to Intelligent Module instruction writes a block of data (1 to 128 bytes maximum) to an intelligent I/O module from a block of V-memory in the CPU. The function parameters are loaded into the first and second level of the accumulator stack and the accumulator by three additional instructions. Listed below are the steps necessary to program the Read from Intelligent module function.
Step 1: Load the base number (0 to 3) into the first byte and the slot number (0 to 7) into the second byte of the second level of the accumulator stack.
Step 2: Load the number of bytes to be transferred into the first level of the accumulator stack (maximum of 128 bytes).
Step 3: Load the intelligent module address which will receive the data into the accumulator. This parameter must be a HEX value.
Step 4: Insert the WT instruction which specifies the starting V-memory location (Vaaa) where the data will be written from in the CPU.
Helpful hint: Use the LDA instruction to convert an octal address to its HEX equivalent and load it into the accumulator when the hex format is required.
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example, when X1 is on, the WT instruction will write six bytes of data to an intelligent module in base 1, slot 2 starting at address 0 in the intelligent module and copy the information from V-memory locations V1400–V1402.S
tand
ard
V aaaWT
DirectSOFT
Handheld Programmer Keystrokes
LDK0102
X1 The constant value K0102specifies the base number(01) and the base slotnumber (02)
LDK6
The constant value K6specifies the number ofbytes to be written
LDK0
The constant value K0specifies the starting addressin the intelligent module
WTV1400
V1400 is the startinglocation in the CPU wherethe specified data will bewritten from
V1401 7 8 5 6
V1402 0 1 9 0
V1403 X X X X
V1404 X X X X
V1377 X X X X
V1400 3 4 1 2
Data
12
34
56
78
90
01
Address 0
Address 1
Address 2Address 3Address 4
Address 5
CPU Intelligent Module
1B ENT
0A
STR$
SHFT ANDSTL
3D
SHFT ANDNW
PREV
4E
0A
1B
0A
2C ENT
6GSHFT ANDST
L3
D PREV ENT
0ASHFT ANDST
L3
D PREV ENT
MLRT
1B
0A ENT
Discrete Bit Flags Description SP54 On when RX, WX, RD, WT instructions are executed with the wrong parameters.
DS UsedHPP Used
�����
230
240
250-1
260
262
Operand Data TypeRange
D2-230 D2-240 D2-250-1 D2-260/D2-262aaa aaa aaa aaa
V-memory V All (See page 3-54) All (See page 3-55) All (See page 3-56) All (See page 3-57)
DL205 User Manual, 5th Edition, Rev. B 5-193
Chapter 5: Standard RLL Instructions
Network InstructionsRead from Network (RX)
The Read from Network instruction is used by the master device on a network to read a block of data from another CPU. The function parameters are loaded into the first and second levels of the accumulator stack and the accumulator by three additional instructions. Listed below are the steps necessary to program the Read from Network function.
Step 1: Load the slave address (0 to 90 BCD) into the first byte, and load the PLC internal port (KF1) or slot number of the master DCM or ECOM (0 to 7) into the second byte of the second level of the accumulator stack.
Step 2: Load the number of bytes (0 to 128 BCD, multiple of 2) to be transferred into the first level of the accumulator stack.
Step 3: Load the address of the data to be read into the accumulator. This parameter requires a HEX value.
Step 4: Insert the RX instruction which specifies the starting V-memory location (Aaaa) where the data will be read from in the slave.
Helpful hint: For parameters that require HEX values, the LDA instruction can be used to convert an octal address to the HEX equivalent and load the value into the accumulator.
Operand Data TypeRange
D2-240 D2-250-1 D2-260/D2-262 A aaa aaa aaaV-memory V All (See page 3 - 54) All (See page 3 - 55) All (See page 3 - 56)
Pointer P All V-memory (See page 3 - 54)
All V-memory (See page 3 - 55)
All V-memory (See page 3 - 56)
Inputs X 0-477 0-777 0-1777Outputs Y 0-477 0-777 0-1777Control Relays C 0-377 0-1777 0-3777Stage S 0-777 0-1777 0-1777Timer T 0-177 0-377 0-377Counter CT 0-177 0-177 0-377Global I/O GX/GY - - 0-3777Special Relay SP 0-137 540-617 0-777 0-777
A aaaRX
230
240
250-1
260
262
�����DS Used
HPP Used
DL205 User Manual, 5th Edition, Rev. B5-194
Chapter 5: Standard RLL Instructions
In the following example, when X1 is on and the module busy relay SP124 (see special relays) is not on, the RX instruction will access an ECOM or DCM operating as a master in slot 2. Ten consecutive bytes of data (V2000 – V2004) will be read from a CPU at station address 5 and copied into V-memory locations V2300–V2304 in the CPU with the master DCM or ECOM.
Sta
ndar
d R
LLIn
stru
ctio
ns
DirectSOFT
Handheld Programmer Keystrokes
LDK0205
X1
The constant value K0205 specifiesthe ECOM/DCM slot number (2) andthe slave address (5)
LDK10
The constant value K10specifies the number ofbytes to be read
LDAO 2300
Octal address 2300 isconverted to 4C0 HEX andloaded into the accumulator.V2300 is the startinglocation for the Master CPUwhere the specified data willbe read into
RXV2000
V2000 is the starting locationin the Slave CPU where thespecified data will be read from
V20018 5 3 4
V20021 9 3 6
V20039 5 7 1
V20041 4 2 3
V1777X X X X
V20003 4 5 7
MasterCPU
SP124
V2005X X X X
V2301 8 5 3 4
V2302 1 9 3 6
V2303 9 5 7 1
V2304 1 4 2 3
V2277 X X X X
V2300 3 4 5 7
V2305 X X X X
SlaveCPU
STR$
SHFT ANDSTL
3D SHFT JMP
K
SHFT ANDSTL
3D
ANDNW SHFT STRN
SP1
B2
C4
E ENT
1B
0A ENT
0A
SHFT ORNR
SETX
1B ENT
2C
3D
0A
0A ENT
2C
0A
0A
0A ENT
SHFT ANDSTL
3D SHFT JMP
K0
A ENT2C
5F
The constant value KF105specifies the bottom portand the slave address (5)(DL250–1 and DL260 only)
LDKF105–or–
DL205 User Manual, 5th Edition, Rev. B 5-195
Chapter 5: Standard RLL Instructions
Write to Network (WX)The Write to Network instruction is used to write a block of data from the master device to a slave device on the same network. The function parameters are loaded into the first and second levels of the accumulator stack and the accumulator by three additional instructions. Listed below are the steps necessary to program the Write to Network function.
Step 1: Load the slave address (0 to 90 BCD) into the first byte and the PLC internal port (KF1) or slot number of the master DCM or ECOM (0 to 7) into the second byte of the second level of the accumulator stack.
Step 2: Load the number of bytes (0 to 128 BCD, multiple of 2) to be transferred into the first level of the accumulator stack.
Step 3: Load the address of the data in the master that is to be written to the network into the accumulator. This parameter requires a HEX value.
Step 4: Insert the WX instruction which specifies the starting V-memory location (Aaaa) where the data will be written to the slave.
Helpful hint: — For parameters that require HEX values, the LDA instruction can be used to convert an octal address to the HEX equivalent and load the value into the accumulator.
Standard R
LLInstructions
A aaaWX
230
240
250-1
260
262
�����
Operand Data Type RangeD2-240 D2-250-1 D2-260/D2-262
A aaa aaa aaaV-memory V All (See page 3 - 54) All (See page 3 - 55) All (See page 3 - 56)
Pointer P All V-memory (See page 3 - 54)
All V-memory (See page 3 - 55)
All V-memory (See page 3 - 56)
Inputs X 0-477 0-777 0-1777Outputs Y 0-477 0-777 0-1777Control Relays C 0-377 0-1777 0-3777Stage S 0-777 0-1777 0-1777Timer T 0-177 0-377 0-377Counter CT 0-177 0-177 0-377Global I/O GX/GY - - 0-3777Special Relay SP 0-137 540-617 0-777 0-777
DS UsedHPP Used
DL205 User Manual, 5th Edition, Rev. B5-196
Chapter 5: Standard RLL Instructions
In the following example when X1 is on and the module busy relay SP124 (see special relays) is not on, the WX instruction will access a DCM or ECOM operating as a master in slot 2. Ten consecutive bytes of data is read from the CPU at station address 5 and copied to V-memory locations V2000–V2004 in the slave CPU.
Sta
ndar
d R
LL
DirectSOFT
Handheld Programmer Keystrokes
LDK0205
X1
LDK10
The constant value K10specifies the number ofbytes to write
LDAO 2300
WXV2000
V2000 is the starting locationin the Slave CPU where thespecified data will be written to.
V20018 5 3 4
V20021 9 3 6
V20039 5 7 1
V20041 4 2 3
V1777X X X X
V20003 4 5 7
MasterCPU
SP124
V2005X X X X
V2301 8 5 3 4
V2302 1 9 3 6
V2303 9 5 7 1
V2304 1 4 2 3
V2277 X X X X
V2300 3 4 5 7
V2305 X X X X
SlaveCPU
Octal address 2300 isconverted to 4C0 HEX andloaded into the accumulator.V2300 is the startinglocation for the Master CPUwhere the specified data willbe written from.
STR$
SHFT ANDSTL
3D SHFT JMP
K
SHFT ANDSTL
3D
ANDNW SHFT STRN
SP1
B2
C4
E ENT
1B
0A ENT
SHFT0A
INST#O
2C
3D
0A
0A ENT
SHFT SHFT ANDV
2C
0A
0A
0A ENTSET
XANDNW
SHFT ANDSTL
3D SHFT JMP
K0
A ENT2C
5F
1B ENT
The constant value KF105specifies the bottom portand the slave address (5)(DL250–1 and DL260 only)
LDKF105–or–
The constant value K0205 specifiesthe ECOM/DCM slot number (2) andthe slave address (5)
DL205 User Manual, 5th Edition, Rev. B 5-197
Chapter 5: Standard RLL Instructions
Message InstructionsFault (FAULT)
The Fault instruction is used to display a message on the 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 ASCII Conversion Table.
To display the value in a V-memory location, specify the V-memory location in the instruction. To display the data in ACON (ASCII constant) or NCON (Numerical constant) instructions, specify the constant (K) value for the corresponding data label area.
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 Appendix C) if you are attempting to use the FAULT instructions in applications that require faster than normal execution cycles.
Operand Data TypeRange
D2-240 D2-250-1 D2-260/D2-262 A aaa aaa aaaV-memory V All (See page 3-55) All (See page 3-56) All (See page 3-57)Constant. K 1-FFFF 1-FFFF 1-FFFF
Standard R
LLInstructions
FAULTA aaa
230
240
250-1
260
262
�����DS Used
HPP Used
DL205 User Manual, 5th Edition, Rev. B5-198
Chapter 5: Standard RLL Instructions
Fault ExampleIn 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 ...)
Sta
ndar
d R
LLIn
stru
ctio
ns
DirectSOFT
Handheld Programmer Keystrokes
DLBLK1
END
FAULTK1
X1
ACONA SW
NCONK 2031
NCONK 3436
STR$
SHFT 4E
TMRN
3D ENT
SHFT 3D
ANDSTL
1B
ANDSTL
1B ENT
SHFT 0A
2C
INST#O
TMRN
SHFT TMRN
2C
INST#O
TMRN
SHFT TMRN
2C
INST#O
TMRN
SW 146
1B ENT
ENT
ENT3D
3D
4E
6G
ENT3D
2C
0A
1B
RSTS
ANDNW
SHFT ISGU
MLRT
ANDSTL
5F
0A
1B ENT
�
�
�
�
DL205 User Manual, 5th Edition, Rev. B 5-199
Chapter 5: Standard RLL Instructions
Data Label (DLBL)The Data Label instruction marks the beginning of an ASCII/ numeric data area. DLBLs are programmed after the End statement. A maximum of 64 (D2-240 and D2-250-1D2-260/D2-262) or 32 (D2-230) DLBL instructions can be used in a program. Multiple NCONs and ACONs can be used in a DLBL area.
ASCII Constant (ACON)The ASCII Constant instruction is used with the DLBL instruction to store ASCII text for use with other instructions. Two ASCII characters can be stored in an ACON instruction. If only one character is stored in an ACON, a leading space will be printed in the Fault message.
Numerical Constant (NCON)The Numerical Constant instruction is used with the DLBL instruction to store the HEX ASCII equivalent of numerical data for use with other instructions. Two digits can be stored in an NCON instruction.
K aaaDLBL
A aaaACON
Operand Data Type D2-230 Range D2-240 Range D2-250-1 Range D2-260/D2-262 Rangeaaa aaa aaa aaa
ASCII A 0-9 A-Z 0-9 A-Z 0-9 A-Z 0-9 A-Z
�����
230
240
250-1
260
262
K aaaNCON
Operand Data TypeRange
D2-230 D2-240 D2-250-1 D2-260/D2-262aaa aaa aaa aaa
Constant K 1-FFFF 1-FFFF 1-FFFF 1-FFFF
Operand Data TypeRange
D2-230 D2-240 D2-250-1 D2-260/D2-262aaa aaa aaa aaa
Constant K 0-FFFF 0-FFFF 0-FFFF 0-FFFF
DS UsedHPP Used
�����
230
240
250-1
260
262
�����
230
240
250-1
260
262
DL205 User Manual, 5th Edition, Rev. B5-200
Chapter 5: Standard RLL Instructions
Data Label ExampleIn 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
Handheld Programmer Keystrokes
DLBLK1
END
ACONA SW
NCONK 2031
NCONK 3436
SHFT 4E
TMRN
3D ENT
SHFT 3D
ANDSTL
1B
ANDSTL
1B ENT
SHFT 0A
2C
INST#O
TMRN
SHFT TMRN
2C
INST#O
TMRN
SHFT TMRN
2C
INST#O
TMRN
ENT3D
3D
4E
6G
ENT3D
2C
0A
1B
ENTRSTS
ANDNW
DL205 User Manual, 5th Edition, Rev. B 5-201
Chapter 5: Standard RLL Instructions
Print Message (PRINT)The Print Message instruction prints the embedded text or text/data variable message to the specified communications port (port 2 on the D2-250-1, D2-260 and D2-262 CPUs), which must have the communications port configured.
You may recall from the CPU specifications in Chapter 3 that the D2-250–1, D2-260 and D2-262 ports are capable of several protocols. To configure a port using the Handheld Programmer, use 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 Comm Port.
• Port: From the port number list box at the top, choose “Port 2.”• Protocol: Click the check box to the left of “Non-sequence.” The Setup Communication
Ports dialog box opens.
• Memory Address: Choose a V-memory address for DirectSOFT to use to store the port setup information. You will need to reserve 66 contiguous words in V-memory for this purpose. Select “Use for printing only” if it applies.
• Baud Rate: Choose the baud rate that matches your printer.• Stop 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 Close. See Chapter 3 for port wiring information to connect your printer to the D2-250-1, D2-260 and D2-262 CPUs.
PRINT A aaa
“Hello, this is a PLC message”
Data TypeRange
D2-250-1 D2-260/D2-262 A aaa aaaConstant K 2 2
230
240
250-1
260
262
�����
DS UsedHPP N/A
DL205 User Manual, 5th Edition, Rev. B5-202
Chapter 5: Standard RLL Instructions
Port 2 on the D2-250-1, D2-260 and D2-262 CPUs 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:
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.
# Character code Description1 $$ Dollar sign ($)2 $” Double quotation (“)3 $L or $1 Line feed (LF)4 $N or $n Carriage return line feed (CRLF)5 $P or $p Form feed6 $R or $r Carriage return (CR)7 $T or $t Tab
X1 Print the message to Port 2 whenX1 makes an off-to-on transition.
PRINT K2
“Hello, this is a PLC message.$N”
DL205 User Manual, 5th Edition, Rev. B 5-203
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.
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.
Example:
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
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 of text, and the $N adds a carriage return / line feed.
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 “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 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.
# Character code Description1 none 16-bit binary (decimal number)2 : B 4-digit BCD3 : D 32-bit binary (decimal number)4 : D B 8-digit BCD5 : R Floating point number (real number)6 : E Floating point number (real number with exponent)
X1 Print the message to Port 2when X1 makes an off-to-ontransition.
PRINT K2“Reactor temperature = ” V2000 “deg. $N”
Message will read:Reactor temperature = 0156 deg.
represents a space^
^ ^
DL205 User Manual, 5th Edition, Rev. B5-204
Chapter 5: Standard RLL Instructions
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.
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:
The Handheld Programmer’s mnemonic is “PRINT,” followed by the DEF field.
Special relay flags SP116 and SP117 indicate the status of the D2-250-1, D2-260 and D2-262 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.
# Data format Description1 none Print 1 for an ON state, and 0 for an OFF state2 : BOOL Print “TRUE” for an ON state, and “FALSE” for an OFF state3 : ONOFF Print “ON” for an ON state, and “OFF” for an OFF state
Element type Maximum Characters
Text, 1 character 116-bit binary 632-bit binary 114-digit BCD 48-digit BCD 8Floating point (real number) 13Floating point (real with exponent) 13V-memory/text 2Bit (1/0 format) 1Bit (TRUE/FALSE format) 5Bit (ON/OFF format) 3
DL205 User Manual, 5th Edition, Rev. B 5-205
Chapter 5: Standard RLL Instructions
Modbus RTU Instructions (D2-260/D2-262)Modbus Read from Network (MRX)
The Modbus Read from Network (MRX) instruction is used by the D2-260 and D2-262 network master to read a block of data from a connected slave device and to write the data into V–memory 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 transfer, Modbus data format and the Exception Response Buffer.
• Port Number: must be D2-260/D2-262 Port 2 (K2)• Slave Address: specify a slave station address (1 to 247)• Function Code: The following Modbus function codes are supported by the MRX
instruction: 01 – Read a group of coils 02 – Read a group of inputs 03 – Read holding registers 04 – Read input registers 07 – Read Exception status• Start Slave Memory Address: specifies the starting slave memory address of the data to be
read. See the table on the following page.• Start Master Memory Address: specifies the starting memory address in the master where
the data will be placed. See the table on the following page.• Number of Elements: specifies how many coils, inputs, holding registers or input
registers will be read. See the table on the following page.• Modbus Data Format: specifies Modbus 584/984 or 484 data format to be used.
�����
230
240
250-1
260
262
DS UsedHPP N/A
DL205 User Manual, 5th Edition, Rev. B5-206
Chapter 5: Standard RLL Instructions
• Exception 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 ByteV-Memory 2 Hi Byte = One of the CRC BytesV-Memory 2 Lo Byte = Exception CodeV-Memory 3 Hi Byte = 0V-Memory 3 Lo Byte = Other CRC Byte
MRX Slave Memory Address
MRX Master Memory Addresses
MRX Slave Address RangesFunction Code Modbus Data Format Slave Address Range(s)
01-Read Coil 484 Mode 1-99901-Read Coil 584/984 Mode 1-6553502-Read Input Status 484 Mode 1001-1999
02-Read Input Status 584/984 Mode 10001-19999 (5 digit) or 100001-165535 (6 digit)
03-Read Holding Register 484 Mode 4001-4999
03-Read Holding Register 584/984 40001-49999 9 (5 digit) or 4000001-465535 (6 digit)
04-Read Input Register 484 Mode 3001-3999
04-Read Input Register 584/984 Mode 30001-39999 (5 digit) or 3000001-365535 (6 digit)
07-Read Exception Status 484 and 584/984 Mode n/a
MRX Master Memory Address RangesOperand Data Type D2-260/D2-262 Range
Inputs X 0-1777Outputs Y 0-1777Control Relays C 0-3777Stage Bits S 0-1777Timer Bits T 0-377Counter Bits CT 0-377Special Relays SP 0-777V-memory V all (see page 3-57)Global Inputs GX 0-3777Global Outputs GY 0-3777
DL205 User Manual, 5th Edition, Rev. B 5-207
Chapter 5: Standard RLL Instructions
MRX Number of Elements
MRX Exception Response Buffer
MRX ExampleD2-260 and D2-262 port 2 has two Special Relay contacts associated with it (see Appendix D for comm port special relays). One indicates “Port busy” (SP116), and the other indicates ”Port Communication Error” (SP117). The “Port Busy” bit is on while the PLC communicates with the slave. When the bit is off, the program can initiate the next network request. The “Port Communication Error” bit turns on when the PLC has detected an error. Use of this bit is optional. When used, it should be ahead of any network instruction boxes since the error bit is reset when an MRX or MWX instruction is executed.
Typically, network communications will last longer than one CPU scan. The program must wait for the communications to finish before starting the next transaction.
Number of ElementsOperand Data Type D2-260/D2-262 Range
V-memory V All (see page 3-57)
Constant K Bits: 1-2000Registers: 1-125
Exception Response BufferOperand Data Type D2-260/D2-262 Range
V-memory V All (see page 3-57)
This rung does a Modbus read from the first 32 coils of slave address number one.It will place the value into 32 bits of the master starting at C0.
SP116Port 2 Busy Bit
C100Instruction Interlock Bit MRX
CPU/DCM Slot: CPUPort Number:Slave Address:Function Code:Start Slave Memory Address:Start Master Memory Address:Number of Elements:Modbus Data Type:Exception Response Buffer:
K2K1
01 - Read Coil StatusK1C0
K32584/984 Mode
V400
RSTC100
Instruction Interlock Bit
1
DL205 User Manual, 5th Edition, Rev. B5-208
Chapter 5: Standard RLL Instructions
Modbus Write to Network (MWX)The Modbus Write to Network (MWX) instruction is used by a D2-262 or D2-262 network master to write a block of data from V-memory to Modbus memory addresses within a slave device on the network. The instruction allows the user to specify the Modbus Function Code, slave station address, starting master and slave memory addresses, number of elements to transfer, Modbus data format and the Exception Response Buffer.
• Port Number: must be D2-260 or D2-262 Port 2 (K2)• Slave Address: specify a slave station address (0 to 247)• Function Code: The following Modbus function codes are supported by the MWX
instruction: 05 – Force Single coil 06 – Preset Single Register 15 – Force Multiple Coils 16 – Preset Multiple Registers• Start Slave Memory Address: specifies the starting slave memory address where the data
will be written• Start Master Memory Address: specifies the starting address of the data in the master that
is to be written to the slave• Number of Elements: specifies how many consecutive coils or registers will be written to.
This field is only active when either function code 15 or 16 is selected• Modbus Data Format: specifies Modbus 584/984 or 484 data format to be used
�����
230
240
250-1
260
262
DS UsedHPP N/A
DL205 User Manual, 5th Edition, Rev. B 5-209
Chapter 5: Standard RLL Instructions
• Exception 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 ByteV-Memory 2 Hi Byte = One of the CRC BytesV-Memory 2 Lo Byte = Exception CodeV-Memory 3 Hi Byte = 0V-Memory 3 Lo Byte = Other CRC Byte
MWX Slave Memory Address
MWX Master Memory Addresses
MWX Slave Address RangesFunction Code Modbus Data Format Slave Address Range(s)
05 - Force Sinlge Coil 484 Mode 1-99905 - Force Single Coil 584/984 Mode 1-6553506 - Preset Single Register 484 Mode 4001-4999
06 - Preset Single Register 584/984 Mode40001-49999 (5 digit) or 400001-465535 (6 digit)
15 - Force Multiple Coils 484 Mode 1-99915 - Force Multiple Coils 584/984 Mode 1-6553516 - Preset Multiple Registers 484 Mode 4001-4999
16 - Preset Multiple Registers 584/984 Mode40001-49999 (5 digit) or 4000001-465535 (6 digit)
MWX Master Memory Address RangesOperand Data Type D2-260/D2-262 Range
Inputs X 0-1777Outputs Y 0-1777Control Relays C 0-3777Stage Bits S 0-1777Timer Bits T 0-377Counter Bits CT 0-377Special Relays SP 0-777V-memory V all (see page 3-57)Global Inputs GX 0-3777Global Outputs GY 0-3777
DL205 User Manual, 5th Edition, Rev. B5-210
Chapter 5: Standard RLL Instructions
MWX Number of Elements
MWX Exception Response Buffer
MWX ExampleD2-260 and D2-262 port 2 has two Special Relay contacts associated with it (see Appendix D for comm port special relays). One indicates “Port busy” (SP116), and the other indicates ”Port Communication Error” (SP117). The “Port Busy” bit is on while the PLC communicates with the slave. When the bit is off, the program can initiate the next network request. The “Port Communication Error” bit turns on when the PLC has detected an error. Use of this bit is optional. When used, it should be ahead of any network instruction boxes since the error bit is reset when an MRX or MWX instruction is executed.
Typically, network communications will last longer than one CPU scan. The program must wait for the communications to finish before starting the next transaction.
This rung does a Modbus write to the first holding register 40001 of the slave address 1. It will write the values to V2000. This particular function code only writes to one register. Use Function Code 16 to writeto multiple registers. Only one network instruction (WX, RX, MWX, MRX) can be enabled in each one scan.That is the reason for the interlock bits. For using many network instructions on the same port, look atusing the shift register instruction.
SP116Port 2 Busy Bit
C100Instruction Interlock Bit MWX
CPU/DCM Slot: CPUPort Number:Slave Address:Function Code:Start Slave Memory Address:Start Master Memory Address:Number of Elements:Modbus Data Type:Exception Response Buffer:
K2K1
05 - Force Single Coil40001V2000
n/a584/984 Mode
V400
RSTC100
Instruction Interlock Bit
1
Exception Response BufferOperand Data Type D2-260/D2-262 Range
V-memory V all (see page 3-57)
Number of ElementsOperand Data Type D2-260/D2-262 Range
V-memory V all (see page 3-57)
Constant K Bits: 1-2000Registers: 1-125
DL205 User Manual, 5th Edition, Rev. B 5-211
Chapter 5: Standard RLL Instructions
ASCII Instructions (D2-260/D2-262)The D2-260 and D2-262 CPU supports several instructions and methods that allow ASCII strings to be read into and written from the PLC communications ports.
Specifically, port 2 on the D2-260 and D2-262 can be used for either reading or writing raw ASCII strings, but cannot be used for both on the same CPU.
The D2-260 and D2-262 can also decipher ASCII embedded within a supported protocol (K–Sequence, DirectNET, Modbus, Ethernet) via the CPU ports, H2–ECOM or D2–DCM module.
ASCII character tables and descriptions can be found at www.asciitable.com.
Reading ASCII Input StringsThere are several methods which the D2-260 and D2-262 can use to read ASCII input strings:
1) ASCII IN (AIN) – This instruction configures port 2 for raw ASCII input strings with parameters such as fixed and variable length ASCII strings, termination characters, byte swapping options, and instruction control bits. Use barcode scanners, weight scales, etc., to write raw ASCII input strings into port 2 based on the (AIN) instruction’s parameters.
2) Write embedded ASCII strings directly to V–memory from an external HMI or similar master device via a supported communications protocol using the CPU ports, H2–ECOM or D2–DCM module. The AIN instruction is not used in this case.
3) If a D2-260 or a D2-262 PLC is a master on a network, the Network Read instruction (RX) can be used to read embedded ASCII data from a slave device via a supported communications protocol using port 2, H2–ECOM or D2–DCM module. The RX instruction places the data directly into V–memory.
Writing ASCII Output StringsThe following instructions can be used to write ASCII output strings:
1) Print from V–memory (PRINTV) – Use this instruction to write raw ASCII strings out of port 2 to a display panel or a serial printer, etc. The instruction features the starting V–memory address, string length, byte swapping options, etc. When the instruction’s permissive bit is enabled, the string is written to port 2.
2) Print to V–memory (VPRINT) – Use this instruction to create pre–coded ASCII strings in the PLC (i.e. alarm messages). When the instruction’s permissive bit is enabled, the message is loaded into a pre–defined V–memory address location. Then use the PRINTV instruction to write the pre–coded ASCII string out of port 2. American, European and Asian Time/Date stamps are supported.
Additionally, if a D2-260 or a D2-262 PLC is a master on a network, the Network Write instruction (WX) can be used to write embedded ASCII data to an HMI or slave device directly from V–memory via a supported communications protocol using port 2, H2–ECOM or D2–DCM module.
�����
230
240
250-1
260
262
DS UsedHPP N/A
DL205 User Manual, 5th Edition, Rev. B5-212
Chapter 5: Standard RLL Instructions
Managing the ASCII StringsThe following instructions can be helpful in managing the ASCII strings within the CPU’s V-memory:
ASCII Find (AFIND) – Finds where a specific portion of the ASCII string is located in continuous V-memory addresses. Forward and reverse searches are supported.
ASCII Extract (AEX) – Extracts a specific portion (usually some data value) from the ASCII find location or other known ASCII data location.
Compare V-memory (CMPV) – This instruction is used to compare two blocks of V-memory addresses and is usually used to detect a change in an ASCII string. Compared data types must be of the same format (i.e., BCD, ASCII, etc.).
Swap Bytes (SWAPB) – usually used to swap V-memory bytes on ASCII data that was written directly to V-memory from an external HMI or similar master device via a communications protocol. The AIN and AEX instructions have a built–in byte swap feature.
ASCII Input (AIN)The ASCII Input instruction allows the CPU to receive ASCII strings through the specified communications port and places the string into a series of specified V-memory registers. The ASCII data can be received as a fixed number of bytes or as a variable length string with a specified termination character(s). Other features include Byte Swap preferences, Character Timeout, and user-defined flag bits for Busy, Complete and Timeout Error.
�����
230
240
250-1
260
262
DS UsedHPP N/A
DL205 User Manual, 5th Edition, Rev. B 5-213
Chapter 5: Standard RLL Instructions
AIN Fixed Length Configuration• Length Type: select fixed length based on the length of the ASCII string that will be sent
to the CPU port.• Port Number: must be D2-260/D2-262 port 2 (K2).• Data Destination: specifies where the ASCII string will be placed in V–memory.• Fixed Length: specifies the length, in bytes, of the fixed-length ASCII string the port will
receive.• Inter–character Timeout: if the amount of time between incoming ASCII characters
exceeds the set time, the specified Timeout Error bit will be set. No data will be stored at the Data Destination V–memory location. The bit will reset when the AIN instruction permissive bits are disabled. None selection disables this feature.
• First Character Timeout: if the amount of time from when the AIN is enabled to the time the first character is received exceeds the set time, the specified First Character Timeout bit will be set. The bit will reset when the AIN instruction permissive bits are disabled. None selection disables this feature.
• Byte Swap: swaps the high–byte and low–byte within each V–memory register of the Fixed Length ASCII string. See the SWAPB instruction for details.
• Busy Bit: is ON while the AIN instruction is receiving ASCII data.• Complete Bit: is set once the ASCII data has been received for the specified fixed length
and reset when the AIN instruction permissive bits are disabled.• Inter–character Timeout Error Bit: is set when the Character Timeout is exceed. See
Character Timeout explanation above. • First Character Timeout Error Bit: is set when the First Character Timeout is exceeded.
See First Character Timeout explanation above.
Parameter D2-260/D2-262 RangeData Destination All V-memory (See page 3 -56)Fixed Length K1-128Bits: Busy, Complete, Timeout Error, Overflow C0-3777
Discrete Bit Flags Description SP53 On if the CPU cannot execute the instructionSP71 On when a value used by the instruction is invalidSP116 On when CPU port 2 is communicating with another deviceSP117 On when CPU port 2 has experienced a communication error
DL205 User Manual, 5th Edition, Rev. B5-214
Chapter 5: Standard RLL Instructions
AIN Fixed Length ExamplesFixed Length example when the PLC is reading the port continuously and timing is not critical.
Fixed Length example when character to character timing is critical.
DL205 User Manual, 5th Edition, Rev. B 5-215
Chapter 5: Standard RLL Instructions
AIN Variable Length Configuration:• Length Type: select Variable Length if the ASCII string length followed by termination
characters will vary in length.• Port Number: must be D2-260/D2-262 port 2 (K2).• Data Destination: specifies where the ASCII string will be placed in V–memory. • Maximum Variable Length: specifies, in bytes, the maximum length of a Variable Length
ASCII string the port will receive.• Inter–character Timeout: if the amount of time between incoming ASCII characters
exceeds the set time, the Timeout Error bit will be set. No data will be stored at the Data Destination V–memory location. The Timeout Error bit will reset when the AIN instruction permissive bits are disabled. None selection disables this feature.
• First Character Timeout: if the amount of time from when the AIN is enabled to the time the first character is received exceeds the set time, the specified First Character Timeout bit will be set. The bit will reset when the AIN instruction permissive bits are disabled. None selection disables this feature.
• Byte Swap: swaps the high–byte and low–byte within each V–memory register of the Varaible Length ASCII string. See the SWAPB instruction for details.
• Termination Code Length: consists of either 1 or 2 characters. Refer to the ASCII table in Appendix G.
• Overflow Error Bit: is set when the ASCII data received exceeds the Maximum Variable Length specified.
• Busy Bit: is ON while the AIN instruction is receiving ASCII data.• Complete Bit: is set once the ASCII data has been received up to the termination code
characters. It will be reset when the AIN instruction permissive bits are disabled. • Inter–character Timeout Error Bit: is set when the Character Timeout is exceed. See
Character Timeout explanation above.• First Character Timeout Error Bit: is set when the First Character Timeout is exceeded.
See First Character Timeout explanation above.
DL205 User Manual, 5th Edition, Rev. B5-216
Chapter 5: Standard RLL Instructions
AIN Variable Length ExampleAIN Variable Length example used to read barcodes on boxes (PE = photoelectric sensor).
Parameter D2-260/D2-262 RangeData Destination All V-memory (See page 3-57)Max. Variable Length K1-128Bits: Busy, Complete, Timeout Error, Overflow C0-3777
DL205 User Manual, 5th Edition, Rev. B 5-217
Chapter 5: Standard RLL Instructions
ASCII Find (AFIND)The ASCII Find instruction locates a specific ASCII string or portion of an ASCII string within a range of V-memory registers and places the string’s Found Index number (byte number where desired string is found) in Hex, into a specified V-memory register. Other features include, Search Starting Index number for skipping over unnecessary bytes before beginning the FIND operation, Forward or Reverse direction search, and From Beginning and From End selections to reference the Found Index Value.
• Base Address: specifies the beginning V-memory register where the entire ASCII string is stored in memory.
• Total Number of Bytes: specifies the total number of bytes to search for the desired ASCII string.
• Search Starting Index: specifies which byte to skip to (with respect to the Base Address) before beginning the search.
• Direction: Forward begins the search from lower numbered V-memory registers to higher numbered V-memory registers. Reverse does the search from higher numbered V–memory registers to lower-numbered V-memory registers.
• Found Index Value: specifies whether the Beginning or the End byte of the ASCII string found will be loaded into the Found Index register.
• Found Index: specifies the V–memory register where the Found Index Value will be stored. A value of FFFF will result if the desired string is not located in the memory registers specified. A value of EEEE will result if there is a conflict in the AFIND search parameters specified.
• Search for String: up to 128 characters.
�����
230
240
250-1
260
262
Parameter D2-260/D2-262 RangeBase Address All V-memory (See page 3-57)
Total Number of Bytes All V-memory (See page 3-57) or K1-128
Search Starting Index All V-memory (See page 3-57) or K0-127
Found Index All V-memory (See page 3-57)
Discrete Bit Flags Description SP53 On if the CPU cannot execute the instruction.SP71 On when a value used by the instruction is invalid.
DS UsedHPP N/A
DL205 User Manual, 5th Edition, Rev. B5-218
Chapter 5: Standard RLL Instructions
AFIND Search ExampleIn the following example, the AFIND instruction is used to search for the “day” portion of “Friday” in the ASCII string “Today is Friday,” which had previously been loaded into V–memory. Note that a Search Starting Index of constant (K) 5 combined with a Forward Direction Search is used to prevent finding the “day” portion of the word “Today.” The Found Index will be placed into V4000.
Base Address Today
s
Friday.
54h6Fh64h61h79h20h69h73h20h46h72h69h64h61h79h2Eh
Low
Low
Low
Low
Low
Low
Low
Low
High
High
High
High
High
High
High
High
V3000
V3001
V3002
V3003
V3004
V3005
V3006
V3007
i
Reverse Direction Search
Forward Direction Search
0
32
654
1
789
101112131415
Search start Index Number
Beginning Index Number
End Index Number
Found Index Number = V40000012
ASCII CharactersHEX Equivalent
DL205 User Manual, 5th Edition, Rev. B 5-219
Chapter 5: Standard RLL Instructions
AFIND Example Combined with AEX InstructionWhen an AIN instruction has executed, its Complete bit can be used to trigger an AFIND instruction to search for a desired portion of the ASCII string. Once the string is found, the AEX instruction can be used to extract the located string.
DL205 User Manual, 5th Edition, Rev. B5-220
Chapter 5: Standard RLL Instructions
ASCII Extract (AEX)The ASCII Extract instruction extracts a specified number of bytes of ASCII data from one series of V-memory registers and places them into another series of V-memory registers. Other features include Extract at Index for skipping over unnecessary bytes before begining the Extract operation, Shift ASCII Option, for One Byte Left or One Byte Right, Byte Swap and Convert data to a BCD format number.
• Source Base Address: specifies the beginning V-memory register where the entire ASCII string is stored in memory.
• Extract at Index: specifies which byte to skip to (with respect to the Source Base Address) before extracting the data.
• Number of Bytes: specifies the number of bytes to be extracted.
• Shift ASCII Option: shifts all extracted data one byte left or one byte right to displace “unwanted” characters, if necessary.
• Byte Swap: swaps the high–byte and the low–byte within each V-memory register of the extracted data. See the SWAPB instruction for details.
• Convert BCD(Hex) ASCII to BCD (Hex): if enabled, this will convert ASCII numerical characters to Hexadecimal numerical values.
• Destination Base Address: specifies the V-memory register where the extracted data will be stored.
See the previous page for an example using the AEX instruction.
�����
230
240
250-1
260
262
Parameter D2-260/D2-262 RangeSource Base Address All V-memory (See page 3-57)
Extract at Index All V-memory (See page 3-57) or K0-127
Number of Bytes K1-128Destination Base Address All V-memory (See page 3-57)
Discrete Bit Flags Description SP53 On if the CPU cannot execute the instruction.SP71 On when a value used by the instruction is invalid.
DS UsedHPP N/A
DL205 User Manual, 5th Edition, Rev. B 5-221
Chapter 5: Standard RLL Instructions
ASCII Compare (CMPV)The ASCII Compare instruction compares two groups of V–memory registers. The CMPV will compare any data type (ASCII to ASCII, BCD to BCD, etc) of one series (group) of V–memory registers to another series of V–memory registers for a specified byte length.
“Compare from” Starting Address: specifies the beginning V–memory register of the first group of V–memory registers to be compared from.
“Compare to” Starting Address: specifies the beginning 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
CMPV ExampleThe CMPV instruction executes when the AIN instruction is complete. If the compared V–memory tables are equal, SP61 will turn ON.
�����
230
240
250-1
260
262
Parameter D2-260/D2-262 RangeCompare from Starting Address All V-memory (See page 3-57)Compare to Starting Address All V-memory (See page 3-57)
Number of Bytes All V-memory (See page 3-57) or K0-127
Discrete Bit Flags Description SP53 On if the CPU cannot execute the instruction.SP61 On when result is equal.SP71 On when a value used by the instruction is invalid.
Strings are equal
C1
OUT
AIN Complete
CMPV
"Compare from" Starting Address: V3400"Compare to" Starting Address: V3500Number of Bytes: K12
C11SP61
DS UsedHPP N/A
DL205 User Manual, 5th Edition, Rev. B5-222
Chapter 5: Standard RLL Instructions
ASCII Print to V-memory (VPRINT)The ASCII Print to V–memory instruction will write a specified ASCII string into a series of 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 formats and 12- or 24-hour time formats.
• Byte Swap: swaps the high–byte and low–byte within each V–memory register to which the ASCII string is printed. See the SWAPB instruction for details.
• Print to Starting V–memory Address: specifies the beginning of a series of V–memory addresses where the ASCII string will be placed by the VPRINT instruction.
• Starting V–memory Address: the first V–memory register of the series of registers specified will contain the ASCII string’s length in bytes.
• Starting V–memory Address +1: the 2nd and subsequent registers will contain the ASCII string printed to V–memory.
VPRINT Time/Date StampingThe 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.
�����
230
240
250-1
260
262
Parameter D2-260/D2-262 RangePrint to Starting V-memory Address All V-memory (See page 3-57)
Discrete Bit Flags Description SP53 On if the CPU cannot execute the instruction.SP71 On when a value used by the instruction is invalid.
# Character Code Date/Time Stamp Options1 _Date:us American standard (month/day/2 digit year)2 _Date:e European standard (day/month/2 digit year)3 _Date:a Asian standard (2 digit year/month/day)4 _Time:12 standard 12 hour clock (0-12 hour:min am/pm)5 _Time:24 standard 24 hour clock (0-23 hour:min am/pm)
DS UsedHPP N/A
DL205 User Manual, 5th Edition, Rev. B 5-223
Chapter 5: Standard RLL Instructions
VPRINT V-memory elementThe 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 V-memory 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 error code 499.
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.
Example with V2000 = 0018 (binary format)
# Character Code Description1 none 16-bit binary (decimal number)2 : B 4-digit BCD3 : D 32-bit binary (decimal number)4 : D B 8-digit BCD5 : R Floating point number (real number)6 : E Floating point number (real number with exponent)
# Character Code Description1 S Suppresses leading spaces2 C0 Converts leading spaces to zeros3 0 Suppresses leading zeros
V-memory Register with Modifier
Number of Characters1 2 3 4
V2000 0 0 1 8V2000:B 0 0 1 2V2000:B0 1 2
DL205 User Manual, 5th Edition, Rev. B5-224
Chapter 5: Standard RLL Instructions
Example with V2000 = sp sp18 (binary format) where sp = space
VPRINT V-memory text elementThe 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.
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
V-memory Register with Modifier
Number of Characters1 2 3 4
V2000 sp sp 1 8V2000:B sp sp 1 2V2000:BS 1 2V2000:BC0 0 0 1 2
# Data format Description1 none Print 1 for an ON state, and 0 for an OFF state
2 : BOOL Print “TRUE” for an ON state, and “FALSE” for an OFF state
3 : ONOFF Print “ON” for an ON state, and “OFF” for an OFF state
DL205 User Manual, 5th Edition, Rev. B 5-225
Chapter 5: Standard RLL Instructions
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.
Text elementThe 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:
Element Type Maximum Characters
Text, 1 character 116-bit binary 632-bit binary 114-digit BCD 48-digit BCD 8Floating point (real number) 13Floating point (real with exponent) 13V-memory/text 2Bit (1/0 format) 1Bit (TRUE/FALSE format) 5Bit (ON/OFF format) 3
# Character code Description1 $$ Dollar sign ($)2 $” Double quotation (“)3 $L or $l Line feed (LF)4 $N or $n Carriage return line feed (CRLF)5 $P or $p Form feed6 $R or $r Carriage return (CR)7 $T or $t Tab
DL205 User Manual, 5th Edition, Rev. B5-226
Chapter 5: Standard RLL Instructions
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 application development.
VPRINT Example Combined with PRINTV InstructionThe VPRINT instruction is used to create a string in V–memory. The PRINTV is used to print the string out of port 2.
C12Create string permissive
C13Delay Permissive for VPRINT
T1Delay for VPRINT to complete
VPRINTByte Swap:“Print to” Address:
“STX” V3000:B “$0D”
AllV4000
SET
Delay permissive for VPRINT
TMRDelay for VPRINTto complete
T1
K10
PRINTVCPU/DCM Slot:Port Number:Start Address:Number of Bytes:Append:Byte Swap:Busy:Complete:
CPUK2
V4000K12
0D (hexadecimal)None
C0C1
C13
RST
Delay permissive for VPRINTC13
14
15
16
DL205 User Manual, 5th Edition, Rev. B 5-227
Chapter 5: Standard RLL Instructions
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.
• Port Number: must be D2-260/D2-262 port 2 (K2).
• Start Address: specifies the beginning 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.
See the facing page for an example using the PRINTV instruction.
�����
230
240
250-1
260
262
Parameter D2-260/D2-262 RangePort Number port 2 (K2)Start Address All V-memory (See page 3-57)Number of Bytes All V-memory (See page 3-57) or K1-128Bits: Busy, Complete C0-3777
Discrete Bit Flags Description SP53 On if the CPU cannot execute the instruction.SP71 On when a value used by the instruction is invalid.SP116 On when CPU port 2 is communicating with another device.SP117 On when CPU port 2 has experienced a communication error.
DS UsedHPP N/A
DL205 User Manual, 5th Edition, Rev. B5-228
Chapter 5: Standard RLL Instructions
ASCII Swap Bytes (SWAPB)The ASCII Swap Bytes instruction swaps byte positions (high–byte to low–byte and low–byte to high–byte) within each V-memory register of a series of V-memory registers for a specified number of bytes.
• Starting Address: specifies the beginning of a series of V–memory registers the instruction will use to begin byte swapping
• Number of Bytes: specifies the number of bytes, beginning with the Starting Address, to byte swap
�����
230
240
250-1
260
262
Parameter D2-260/D2-262 RangeStarting Address All V-memory (See page 3-57)Number of Bytes All V-memory (See page 3-57) or K1 to 128
Discrete Bit Flags Description SP53 On if the CPU cannot execute the instruction.SP71 On when a value used by the instruction is invalid.
AB
CE
Dxx
V2000
V2001
V2002
V2003
High LowNo Byte Swapping
Byte Swap All
BA
Dxx
C
E
V2000
V2001
V2002
V2003
High Low
0005h
Byte Swap All but Null
BA
DxxC
E
V2000
V2001
V2002
V2003
High Low
0005h
Byte
Byte
0005h
Byte
(AIN, AEX, PRINTV, VPRINT)Byte SwapPreferences
B C D EA
A D C EB
B C D EA
B C D EA
A D C EB
DS UsedHPP N/A
DL205 User Manual, 5th Edition, Rev. B 5-229
Chapter 5: Standard RLL Instructions
SWAPB ExampleThe AIN Complete bit is used to trigger the SWAPB instruction. Use a one–shot so the SWAPB only executes once.
ASCII Clear Buffer (ACRB)The ASCII Clear Buffer instruction will clear the ASCII receive buffer of the specified communications port number.
Port Number: must be D2-260/D2-262 port 2 (K2)
ACRB ExampleThe AIN Complete bit or the AIN diagnostic bits are used to clear the ASCII buffer.
�����
230
240
250-1
260
262
DS UsedHPP N/A
DL205 User Manual, 5th Edition, Rev. B5-230
Chapter 5: Standard RLL Instructions
Intelligent Box (IBox) Instructions (D2-250-1, D2-260 and D2-262 Only)
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 D2-250–1, D2-260 and D2-262 PLCs. The D2-250-1 CPU requires firmware version v4.60 or later, while the D2-260 and D2-262 CPUs requires firmware version v1.0 or later. For more information on DirectSOFT or to download our free version, please visit our Web site at: www.automationdirect.com.
Analog Helper IBoxesInstruction IBox # Page
Analog Input / Output Combo Module Pointer Setup (ANLGCMB) IB-462 5-233Analog Input Module Pointer Setup (ANLGIN) IB-460 5-235Analog Output Module Pointer Setup (ANLGOUT) IB-461 5-237Analog Scale 12-Bit BCD to BCD (ANSCL) IB-423 5-239Analog Scale 12-Bit Binary to Binary (ANSCLB) IB-403 5-240Filter Over Time - BCD (FILTER) IB-422 5-241Filter Over Time - Binary (FILTERB) IB-402 5-243Hi/Low Alarm - BCD (HILOAL) IB-421 5-245Hi/Low Alarm - Binary (HILOALB) IB-401 5-247
Discrete Helper IBoxesInstruction Ibox # Page
Off Delay Timer (OFFDTMR) IB-302 5-249On Delay Timer (ONDTMR) IB-301 5-251One Shot (ONESHOT) IB-303 5-253Push On / Push Off Circuit (PONOFF) IB-300 5-254
Memory IBoxesInstruction Ibox # Page
Move Single Word (MOVEW) IB-200 5-255Move Double Word (MOVED) IB-201 5-256
NOTE: Check your CPU firmware version using DirectSOFT: PLC Menu > Diagnostics > System Information. The latest firmware and update tool are available from: http://support.automationdirect.com/firmware/index.html
DL205 User Manual, 5th Edition, Rev. B 5-231
Chapter 5: Standard RLL Instructions
Intelligent Box (IBox) Instructions, Continued (D2-250-1, D2-260 and D2-262 Only)
Math IBoxesInstruction Ibox # PageBCD to Real with Implied Decimal Point (BCDTOR) IB-560 5-257Double BCD to Real with Implied Decimal Point (BCDTORD) IB-562 5-258Math - BCD (MATHBCD) IB-521 5-259Math - Binary (MATHBIN) IB-501 5-261Math - Real (MATHR) IB-541 5-263Real to BCD with Implied Decimal Point and Rounding (RTOBCD) IB-561 5-264Real to Double BCD with Implied Decimal Point and Rounding (RTOBCDD) IB-563 5-265Square BCD (SQUARE) IB-523 5-266Square Binary (SQUAREB) IB-503 5-267Square Real(SQUARER) IB-543 5-268Sum BCD Numbers (SUMBCD) IB-522 5-269Sum Binary Numbers (SUMBIN) IB-502 5-270Sum Real Numbers (SUMR) IB-542 5-271
Communication IBoxesInstruction Ibox # PageECOM100 Configuration (ECOM100) IB-710 5-273ECOM100 Disable DHCP (ECDHCPD) IB-736 5-275ECOM100 Enable DHCP (ECDHCPE) IB-735 5-277ECOM100 Query DHCP Setting (ECDHCPQ) IB-734 5-279ECOM100 Send E-mail (ECEMAIL) IB-711 5-281ECOM100 Restore Default E-mail Setup (ECEMRDS) IB-713 5-287ECOM100 E-mail Setup (ECEMSUP) IB-712 5-290ECOM100 IP Setup (ECIPSUP) IB-717 5-294ECOM100 Read Description (ECRDDES) IB-726 5-296ECOM100 Read Gateway Address (ECRDGWA) IB-730 5-298ECOM100 Read IP Address (ECRDIP) IB-722 5-300ECOM100 Read Module ID (ECRDMID) IB-720 5-302ECOM100 Read Module Name (ECRDNAM) IB-724 5-304ECOM100 Read Subnet Mask (ECRDSNM) IB-732 5-306ECOM100 Write Description (ECWRDES) IB-727 5-308ECOM100 Write Gateway Address (ECWRGWA) IB-731 5-310ECOM100 Write IP Address (ECWRIP) IB-723 5-312ECOM100 Write Module ID (ECWRMID) IB-721 5-314ECOM100 Write Name (ECWRNAM) IB-725 5-316ECOM100 Write Subnet Mask (ECWRSNM) IB-733 5-318ECOM100 RX Network Read (ECRX) IB-740 5-320ECOM100 WX Network Write (ECWX) IB-741 5-323NETCFG Network Configuration (NETCFG) IB-700 5-326Network RX Read (NETRX) IB-701 5-328Network WX Write (NETWX) IB-702 5-331
DL205 User Manual, 5th Edition, Rev. B5-232
Chapter 5: Standard RLL Instructions
NOTE: Check your CPU firmware version using DirectSOFT: PLC Menu > Diagnostics > System Information. The latest firmware and update tool are available from: http://support.automationdirect.com/firmware/index.html
Counter I/O IBoxes (Work with H2-CTRIO and H2-CTRIO2)Instruction Ibox # PageCTRIO Configuration (CTRIO) IB-1000 5-334CTRIO Add Entry to End of Preset Table (CTRADPT) IB-1005 5-336CTRIO Clear Preset Table (CTRCLRT) IB-1007 5-339CTRIO Edit Preset Table Entry (CTREDPT) IB-1003 5-342CTRIO Edit Preset Table Entry and Reload (CTREDRL) IB-1002 5-346CTRIO Initialize Preset Table (CTRINPT) IB-1004 5-350CTRIO Initialize Preset Table (CTRINTR) IB-1010 5-354CTRIO Load Profile (CTRLDPR) IB-1001 5-358CTRIO Read Error (CTRRDER) IB-1014 5-361CTRIO Run to Limit Mode (CTRRTLM) IB-1011 5-363CTRIO Run to Position Mode (CTRRTPM) IB-1012 5-366CTRIO Velocity Mode (CTRVELO) IB-1013 5-369CTRIO Write File to ROM (CTRWFTR) IB-1006 5-372
Intelligent Box (IBox) Instructions, Continued (D2-250-1, D2-260 and D2-262 Only)
DL205 User Manual, 5th Edition, Rev. B 5-233
Chapter 5: Standard RLL Instructions
Analog Input/Output Combo Module Pointer Setup (ANLGCMB) (IB-462)The Analog Input/Output Combo Module Pointer Setup instruction generates the logic to configure the pointer method for an analog input/output combination module on the first PLC scan following a Program to Run transition.
The ANLGCMB IBox instruction determines the data format and Pointer addresses based on the CPU type, the Base# and the module Slot#.
The Input Data Address is the starting location in user V-memory where the analog input data values will be stored, one location for each input channel enabled.
The Output Data Address is the starting location in user V-memory where the analog output data values will be stored by ladder code or external device, one location for each output channel enabled.
Since the IBox logic only executes on the first scan, the instruction cannot have any input logic.
ANLGCMB Parameters• Base # (K0-Local): specifies which base the module is in.• Slot #: specifies which slot is occupied by the analog module.• Number of Input Channels: specifies the number of analog input channels to scan.• Input Data Format (0-BCD 1-BIN): specifies the analog input data format (BCD or
Binary) - the binary format may be used for displaying data on some OI panels.• Input Data Address: specifies the starting V-memory location that will be used to store
the analog input data.• Number of Output Channels: specifies the number of analog output channels that will be
used.• Output Data Format (0-BCD 1-BIN): specifies the format of the analog output data
(BCD or Binary).• Output Data Address: specifies the starting V-memory location that will be used to
source the analog output data.
DS5 Used
HPP N/A
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-234
Chapter 5: Standard RLL Instructions
ANLGCMB ExampleIn the following example, the ANLGCMB instruction is used to set up the pointer method for an analog I/O combination module that is installed in option slot 2. Four input channels are enabled and the analog data will be written to V2000 - V2003 in BCD format. Two output channels are enabled and the analog values will be read from V2100 - V2101 in BCD format.
NOTE: An Analog I/O IBox instruction is used without a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
No permissive contact or input logic is used with this instruction
Parameter DL205 RangeBase # (K0-Local) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠K K0-3Slot # ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠K K0-7Number of Input Channels ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠K K1-8Input Data Format (0-BCD 1-BIN) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠K BCD: K0; Binary: K1Input Data Address ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V See DL205 V-memory map - Data WordsNumber of Output Channels ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠K K1-8Output Data Format (0-BCD 1-BIN) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠K BCD: K0; Binary: K1 Output Data Address ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V See DL205 V-memory map - Data Words
DL205 User Manual, 5th Edition, Rev. B 5-235
Chapter 5: Standard RLL Instructions
Analog Input Module Pointer Setup (ANLGIN) (IB-460)Analog Input Module Pointer Setup generates the logic to configure the pointer method for one analog input module on the first PLC scan following a Program to Run transition.
This IBox determines the data format and Pointer addresses based on the CPU type, the Base#, and the Slot#.
The Input Data Address is the starting location in user V-memory where the analog input data values will be stored, one location for each input channel enabled.
Since this logic only executes on the first scan, this IBox cannot have any input logic.
ANLGIN Parameters• Base # (K0-Local): specifies which base the analog module is in.• Slot #: specifies which PLC slot is occupied by the analog module.• Number of Input Channels: specifies the number of input channels to scan.• Input Data Format (0-BCD 1-BIN): specifies the analog input data format (BCD or
Binary) - the binary format may be used for displaying data on some OI panels.• Input Data Address: specifies the starting V-memory location that will be used to store
the analog input data.
DS5 Used
HPP N/A
Parameter DL205 RangeBase # (K0-Local) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-3Slot # ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-7Number of Input Channels ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K1-8Input Data Format (0-BCD 1-BIN) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K BCD: K0; Binary: K1Input Data Address ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data Words
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-236
Chapter 5: Standard RLL Instructions
ANLGIN ExampleIn the following example, the ANLGIN instruction is used to set up the pointer method for an analog input module that is installed in option slot 1. Eight input channels are enabled and the analog data will be written to V2000 - V2007 in BCD format.
NOTE: An Analog I/O IBox instruction is used without a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
No permissive contact or input logic is used with
this instruction
DL205 User Manual, 5th Edition, Rev. B 5-237
Chapter 5: Standard RLL Instructions
Analog Output Module Pointer Setup (ANLGOUT) (IB-461)Analog Output Module Pointer Setup generates the logic to configure the pointer method for one analog output module on the first PLC scan following a Program to Run transition.
This IBox determines the data format and Pointer addresses based on the CPU type, the Base#, and the Slot#.
The Output Data Address is the starting location in user V-memory where the analog output data values will be placed by ladder code or external device, one location for each output channel enabled.
Since this logic only executes on the first scan, this IBox cannot have any input logic.
ANLGOUT Parameters• Base # (K0-Local): specifies which base the analog module is in• Slot #: specifies which PLC slot is occupied by the analog module• Number of Output Channels: specifies the number of analog output channels that will be
used• Output Data Format (0-BCD 1-BIN): specifies the format of the analog output data
(BCD or Binary)• Output Data Address: specifies the starting V-memory location that will be used to
source the analog output data
DS5 Used
HPP N/A
Parameter DL205 RangeBase # (K0-Local) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-3Slot # ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-7Number of Output Channels ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K1-8Output Data Format (0-BCD 1-BIN) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K BCD: K0; Binary: K1 Output Data Address ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data Words
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-238
Chapter 5: Standard RLL Instructions
ANLGOUT ExampleIn the following example, the ANLGOUT instruction is used to set up the pointer method for an analog output module that is installed in option slot 3. Two output channels are enabled and the analog data will be read from V2100 - V2101 in BCD format.
NOTE: An Analog I/O IBox instruction is used without a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
No permissive contact or input logic is used with this instruction
DL205 User Manual, 5th Edition, Rev. B 5-239
Chapter 5: Standard RLL Instructions
Analog Scale 12-Bit BCD to BCD (ANSCL) (IB-423)Analog Scale 12-Bit BCD to BCD scales a 12-bit BCD analog value (0 to 4095 BCD) into BCD engineering units. You specify the engineering unit high value (when raw is 4095), and the engineering low value (when raw is 0), and the output V-memory address where you want to place the scaled engineering unit value. The engineering units are generated as BCD and can be the full range of 0 to 9999 (see ANSCLB - Analog Scale 12-Bit Binary to Binary if your raw units are in Binary format).
Note that this IBox only works with unipolar unsigned raw values. It does NOT work with bipolar or sign plus magnitude raw values.
ANSCL Parameters• Raw (0 to 4095 BCD): specifies the V-memory location of the unipolar unsigned raw 0
to 4095 unscaled value• High Engineering: specifies the high engineering value when the raw input is 4095• Low Engineering: specifies the low engineering value when the raw input is 0• Engineering (BCD): specifies the V-memory location where the scaled engineering BCD
value will be placed
ANSCL Example
In the following example, the ANSCL instruction is used to scale a raw value (0 to 4095 BCD) that is in V2000. The engineering scaling range is set 0 to 100 (low engineering value - high engineering value). The scaled value will be placed in V2100 in BCD format.
DS5 Used
HPP N/A
Parameter DL205 RangeRaw (0-4095 BCD) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,P See DL205 V-memory map - Data WordsHigh Engineering ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-9999Low Engineering ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-9999Engineering (BCD) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,P See DL205 V-memory map - Data Words
SP1
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-240
Chapter 5: Standard RLL Instructions
Analog Scale 12-Bit Binary to Binary (ANSCLB) (IB-403)Analog Scale 12-Bit Binary to Binary scales a 12-bit binary analog value (0 to 4095 decimal) into binary (decimal) engineering units. You specify the engineering unit high value (when raw is 4095), and the engineering low value (when raw is 0), and the output V-memory address where you want to place the scaled engineering unit value. The engineering units are generated as binary and can be the full range of 0 to 65535 (see ANSCL - Analog Scale 12-Bit BCD to BCD if your raw units are in BCD format).
Note that this IBox only works with unipolar unsigned raw values. It does NOT work with bipolar, sign plus magnitude, or signed 2’s complement raw values.
ANSCLB Parameters• Raw (12-bit binary): specifies the V-memory location of the unipolar unsigned raw
decimal unscaled value (12-bit binary = 0 to 4095 decimal)• High Engineering: specifies the high engineering value when the raw input is 4095
decimal• Low Engineering: specifies the low engineering value when the raw input is 0 decimal• Engineering (binary): specifies the V-memory location where the scaled engineering
decimal value will be placed
ANSCLB Example
In the following example, the ANSCLB instruction is used to scale a raw value (0 to 4095 binary) that is in V2000. The engineering scaling range is set 0 to 1000 (low engineering value - high engineering value). The scaled value will be placed in V2100 in binary format.
DS5 Used
HPP N/A
SP1
Parameter DL205 RangeRaw (12-bit binary) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,P See DL205 V-memory map - Data WordsHigh Engineering ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-65535Low Engineering ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-65535Engineering (binary) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,P See DL205 V-memory map - Data Words
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-241
Chapter 5: Standard RLL Instructions
Filter Over Time - BCD (FILTER) (IB-422)Filter Over Time BCD will perform a first-order filter on the Raw Data on a defined time interval. The equation is:
New = Old + [(Raw - Old) / FDC] where,
New: New Filtered ValueOld: Old Filtered ValueFDC: Filter Divisor ConstantRaw: Raw Data
The Filter Divisor Constant is an integer in the range K1 to K100, such that if it equaled K1 then no filtering would be done.
The rate at which the calculation is performed is specified by time in hundredths of a second (0.01 seconds) as the Filter Freq Time parameter. Note that this Timer instruction is embedded in the IBox and must NOT be used anywhere else in your program. Power flow controls whether the calculation is enabled. If it is disabled, the Filter Value is not updated. On the first scan from Program to Run mode, the Filter Value is initialized to 0 to give the calculation a consistent starting point.
FILTER Parameters• Filter Frequency Timer: specifies the Timer (T) number which is used by the Filter
instruction.• Filter Frequency Time (0.01sec): specifies the rate at which the calculation is performed.• Raw Data (BCD): specifies the V-memory location of the raw unfiltered BCD value.• Filter Divisor (1 to 100): this constant is used to control the filtering effect. A larger
value will increase the smoothing effect of the filter. A value of 1 results with no filtering.• Filtered Value (BCD): specifies the V-memory location where the filtered BCD value will
be placed.
DS5 Used
HPP N/A
Parameter DL205 RangeFilter Frequency Timer ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ T T0-377Filter Frequency Time (0.01 sec) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-9999Raw Data (BCD) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsFilter Divisor (1-100) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K1-100Filtered Value (BCD) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data Words
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-242
Chapter 5: Standard RLL Instructions
FILTER ExampleIn the following example, the Filter instruction is used to filter a BCD value that is in V2000. Timer(T0) is set to 0.5 sec, the rate at which the filter calculation will be performed. The filter constant is set to 2. A larger value will increase the smoothing effect of the filter. A value of 1 results with no filtering. The filtered value will be placed in V2100.
SP1
DL205 User Manual, 5th Edition, Rev. B 5-243
Chapter 5: Standard RLL Instructions
Filter Over Time - Binary (FILTERB) (IB-402)Filter Over Time in Binary (decimal) will perform a first-order filter on the Raw Data on a defined time interval. The equation is:
New = Old + [(Raw - Old) / FDC] whereNew: New Filtered ValueOld: Old Filtered ValueFDC: Filter Divisor ConstantRaw: Raw Data
The Filter Divisor Constant is an integer in the range K1 to K100, such that if it equaled K1 then no filtering would be done.
The rate at which the calculation is performed is specified by time in hundredths of a second (0.01 seconds) as the Filter Freq Time parameter. Note that this Timer instruction is embedded in the IBox and must NOT be used anywhere else in your program. Power flow controls whether the calculation is enabled. If it is disabled, the Filter Value is not updated. On the first scan from Program to Run mode, the Filter Value is initialized to 0 to give the calculation a consistent starting point.
FILTERB Parameters• Filter Frequency Timer: specifies the Timer (T) number that is used by the Filter
instruction.• Filter Frequency Time (0.01sec): specifies the rate at which the calculation is performed.• Raw Data (Binary): specifies the V-memory location of the raw unfiltered binary
(decimal) value.• Filter Divisor (1 to 100): this constant is used to control the filtering effect. A larger
value will increase the smoothing effect of the filter. A value of 1 results with no filtering.• Filtered Value (Binary): specifies the V-memory location where the filtered binary
(decimal) value will be placed.
DS5 Used
HPP N/A
Parameter DL205 RangeFilter Frequency Timer ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ T T0-377Filter Frequency Time (0.01 sec) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-9999Raw Data (Binary) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsFilter Divisor (1-100) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K1-100Filtered Value (Binary) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data Words
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-244
Chapter 5: Standard RLL Instructions
FILTERB ExampleIn the following example, the FILTERB instruction is used to filter a binary value that is in V2000. Timer(T1) is set to 0.5 sec, the rate at which the filter calculation will be performed. The filter constant is set to 3. A larger value will increase the smoothing effect of the filter. A value of 1 results with no filtering. The filtered value will be placed in V2100
SP1
DL205 User Manual, 5th Edition, Rev. B 5-245
Chapter 5: Standard RLL Instructions
Hi/Low Alarm - BCD (HILOAL) (IB-421)Hi/Low Alarm - BCD monitors a BCD value V-memory location and sets four possible alarm states, High-High, High, Low, and Low-Low whenever the IBox has power flow. You enter the alarm thresholds as constant (K) BCD values (K0-K9999) and/or BCD value V-memory locations.
You must ensure that threshold limits are valid, that is HH >= H > L >= LL. Note that when the High-High or Low-Low alarm condition is true, that the High and Low alarms will also be set, respectively. This means you may use the same threshold limit and same alarm bit for the High-High and the High alarms in case you only need one “High” alarm. Also note that the boundary conditions are inclusive. That is, if the Low boundary is K50, and the Low-Low boundary is K10, and if the Monitoring Value equals 10, then the Low Alarm AND the Low-Low alarm will both be ON. If there is no power flow to the IBox, then all alarm bits will be turned off regardless of the value of the Monitoring Value parameter.
HILOAL Parameters• Monitoring Value (BCD): specifies the V-memory location of the BCD value to be
monitored• High-High Limit: V-memory location or constant specifies the high-high alarm limit• High-High Alarm: On when the high-high limit is reached• High Limit: V-memory location or constant specifies the high alarm limit• High Alarm: On when the high limit is reached• Low Limit: V-memory location or constant specifies the low alarm limit• Low Alarm: On when the low limit is reached• Low-Low Limit: V-memory location or constant specifies the low-low alarm limit• Low-Low Alarm: On when the low-low limit is reached
DS5 Used
HPP N/A
Parameter DL205 RangeMonitoring Value (BCD) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsHigh-High Limit ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V, K K0-9999; or see DL205 V-memory map - Data Words High-High Alarm ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X, Y, C, GX,GY, B See DL205 V-memory mapHigh Limit ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V, K K0-9999; or see DL205 V-memory map - Data WordsHigh Alarm ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X, Y, C, GX,GY, B See DL205 V-memory mapLow Limit ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V, K K0-9999; or see DL205 V-memory map - Data Words Low Alarm ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X, Y, C, GX,GY,B See DL205 V-memory mapLow-Low Limit ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V, K K0-9999; or see DL205 V-memory map - Data WordsLow-Low Alarm⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠X, Y, C, GX,GY, B See DL205 V-memory map
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-246
Chapter 5: Standard RLL Instructions
HILOAL ExampleIn the following example, the HILOAL instruction is used to monitor a BCD value that is in V2000. If the value in V2000 meets/exceeds the High limit of K900, C101 will turn on. If the value continues to increase to meet/exceed the High-High limit, C100 will turn on. Both bits would be on in this case. The High and High-High limits and alarms can be set to the same value if one “High” limit or alarm is desired to be used.
If the value in V2000 meets or falls below the Low limit of K200, C102 will turn on. If the value continues to decrease to meet or fall below the Low-Low limit of K100, C103 will turn on. Both bits would be on in this case. The Low and Low-Low limits and alarms can be set to the same value if one “Low” limit or alarm is desired to be used.
SP1
DL205 User Manual, 5th Edition, Rev. B 5-247
Chapter 5: Standard RLL Instructions
Hi/Low Alarm - Binary (HILOALB) (IB-401)Hi/Low Alarm - Binary monitors a binary (decimal) V-memory location and sets four possible alarm states, High-High, High, Low, and Low-Low whenever the IBox has power flow. You enter the alarm thresholds as constant (K) decimal values (K0-K65535) and/or binary (decimal) V-memory locations.
You must ensure that threshold limits are valid, that is HH >= H > L >= LL. Note that when the High-High or Low-Low alarm condition is true, that the High and Low alarms will also be set, respectively. This means you may use the same threshold limit and same alarm bit for the High-High and the High alarms in case you only need one “High” alarm. Also note that the boundary conditions are inclusive. That is, if the Low boundary is K50, and the Low-Low boundary is K10, and if the Monitoring Value equals 10, then the Low Alarm AND the Low-Low alarm will both be ON. If there is no power flow to the IBox, then all alarm bits will be turned off regardless of the value of the Monitoring Value parameter.
HILOALB Parameters• Monitoring Value (Binary): specifies the
V-memory location of the Binary value to be monitored
• High-High Limit: V-memory location or constant specifies the High-High alarm limit
• High-High Alarm: On when the High-High limit is reached
• High Limit: V-memory location or constant specifies the High alarm limit
• High Alarm: On when the High limit is reached
• Low Limit: V-memory location or constant specifies the Low alarm limit
• Low Alarm: On when the Low limit is reached• Low-Low Limit: V-memory location or constant specifies the Low-Low alarm limit• Low-Low Alarm: On when the Low-Low limit is reached
Parameter DL205 RangeMonitoring Value (Binary) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsHigh-High Limit ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V, K K0-65535; or see DL205 V-memory map - Data Words High-High Alarm ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X, Y, C, GX,GY, B See DL205 V-memory mapHigh Limit ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V, K K0-65535; or see DL205 V-memory map - Data WordsHigh Alarm ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X, Y, C, GX,GY, B See DL205 V-memory mapLow Limit ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V, K K0-65535; or see DL205 V-memory map - Data Words Low Alarm ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X, Y, C, GX,GY,B See DL205 V-memory mapLow-Low Limit ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V, K K0-65535; or see DL205 V-memory map - Data WordsLow-Low Alarm⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠X, Y, C, GX,GY, B See DL205 V-memory map
DS5 Used
HPP N/A
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-248
Chapter 5: Standard RLL Instructions
HILOALB ExampleIn the following example, the HILOALB instruction is used to monitor a binary value that is in V2000. If the value in V2000 meets/exceeds the High limit of the binary value in V2011, C101 will turn on. If the value continues to increase to meet/exceed the High-High limit value in V2010, C100 will turn on. Both bits would be on in this case. The High and High-High limits and alarms can be set to the same V-memory location/value if one “High” limit or alarm is desired to be used.
If the value in V2000 meets or falls below the low limit of the binary value in V2012, C102 will turn on. If the value continues to decrease to meet or fall below the Low-Low limit in V2013, C103 will turn on. Both bits would be on in this case. The Low and Low-Low limits and alarms can be set to the same V-memory location/value if one “Low” limit or alarm is desired to be used.
SP1
DL205 User Manual, 5th Edition, Rev. B 5-249
Chapter 5: Standard RLL Instructions
Off Delay Timer (OFFDTMR) (IB-302)Off Delay Timer will delay the “turning off” of the Output parameter by the specified Off Delay Time (up to 99.99 seconds) based on the power flow into the IBox. Once the IBox receives power, the Output bit will turn on immediately. When the power flow to the IBox turns off, the Output bit WILL REMAIN ON for the specified amount of time (in hundredths of a second). Once the Off Delay Time has expired, the output will turn Off. If the power flow to the IBox comes back on BEFORE the Off Delay Time, then the timer is RESET and the Output will remain On - so you must continuously have NO power flow to the IBox for AT LEAST the specified Off Delay Time before the Output will turn Off.
This IBox utilizes a Timer resource (TMRF), which cannot be used anywhere else in your program.
OFFDTMR Parameters• Timer Number: specifies the Timer
(TMRF) number which is used by the OFFDTMR instruction
• Off Delay Time (0.01sec): specifies how long the Output will remain on once power flow to the Ibox is removed (up to 99.99 seconds).
• Output: specifies the output that will be delayed “turning off” by the Off Delay Time.
Parameter DL205 RangeTimer Number ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ T T0-377Off Delay Time ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠K,V K0-9999; See DL205 V-memory map - Data WordsOutput⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠X, Y, C, GX,GY, B See DL205 V-memory map
DS5 Used
HPP N/A
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-250
Chapter 5: Standard RLL Instructions
OFFDTMR ExampleIn the following example, the OFFDTMR instruction is used to delay the “turning off”of output C20. Timer 2 (T2) is set to 5 seconds, the “off-delay” period.
When C100 turns on, C20 turns on and will remain on while C100 is on. When C100 turns off, C20 will remain on for the specified Off Delay Time (5 secs), and then turn off.
C100
C20
5 sec 5 sec
Example timing diagram
DL205 User Manual, 5th Edition, Rev. B 5-251
Chapter 5: Standard RLL Instructions
On Delay Timer (ONDTMR) (IB-301)On Delay Timer will delay the “turning on” of the Output parameter by the specified amount of time (up to 99.99 seconds) based on the power flow into the IBox. Once the IBox loses power, the Output is turned off immediately. If the power flow turns off BEFORE the On Delay Time, then the timer is RESET and the Output is never turned on, so you must have continuous power flow to the IBox for at least the specified On Delay Time before the Output turns On.
This IBox utilizes a Timer resource (TMRF), which cannot be used anywhere else in your program.
ONDTMR Parameters• Timer Number: specifies the Timer (TMRF) number which is used by the ONDTMR
instruction• On Delay Time (0.01sec): specifies how long the Output will remain on once power flow
to the Ibox is removed (up to 99.99 seconds).• Output: specifies the output that will be delayed “turning on” by the On Delay Time.
Parameter DL205 RangeTimer Number ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ T T0-377On Delay Time ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠K,V K0-9999; See DL205 V-memory map - Data WordsOutput⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠X, Y, C, GX,GY, B See DL205 V-memory map
DS5 Used
HPP N/A
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-252
Chapter 5: Standard RLL Instructions
ONDTMR ExampleIn 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 immediately.
C101
C21
2 sec 2 sec
Example timing diagram
DL205 User Manual, 5th Edition, Rev. B 5-253
Chapter 5: Standard RLL Instructions
One Shot (ONESHOT) (IB-303)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
ONESHOT ExampleIn 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.
C0
C100
Scan time
Example Timing Diagram
Parameter DL205 RangeDiscrete Output ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X, Y, C See DL205 V-memory map
230
240
250-1
260
262
�����DS5 Used
HPP N/A
DL205 User Manual, 5th Edition, Rev. B5-254
Chapter 5: Standard RLL Instructions
Push On/Push Off Circuit (PONOFF) (IB-300)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.”
PONOFF Parameters• Discrete Input: specifies the input that
will toggle the specified output• Discrete Output: specifies the output that
will be “turned on/off” or toggled• Internal State: specifies a work bit that is
used by the instruction
PONOFF ExampleIn 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 C10 is pressed again, C20 turns off. C100 is an internal bit used by the instruction.
NOTE: Neither a permissive nor input logic is required with this instruction.
DS5 Used
HPP N/A
Parameter DL205 RangeDiscrete Input ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,S,T,CT,GX,GY,SP,B,PB See DL205 V-memory map Discrete Output ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapInternal State ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X, Y, C See DL205 V-memory map
No permissive contact or input logic is used with this instruction
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-255
Chapter 5: Standard RLL Instructions
Move Single Word (MOVEW) (IB-200)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 to which
where the “From WORD” will be moved
MOVEW ExampleIn the following example, the MOVEW instruction is used to move 16 bits of data from V2000 to V3000 when C100 turns on.
Parameter DL205 RangeFrom WORD ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,P,K K0-FFFF; See DL205 V-memory map - Data WordsTo WORD ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,P See DL205 V-memory map - Data Words
230
240
250-1
260
262
�����DS5 Used
HPP N/A
DL205 User Manual, 5th Edition, Rev. B5-256
Chapter 5: Standard RLL Instructions
Move Double Word (MOVED) (IB-201)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 to which where the “From DWORD” will be moved
MOVED ExampleIn 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.
Parameter DL205 RangeFrom DWORD ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,P,K K0-FFFFFFFF; See DL205 V-memory map - Data WordsTo DWORD ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,P See DL205 V-memory map - Data Words
DS5 Used
HPP N/A
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-257
Chapter 5: Standard RLL Instructions
BCD to Real with Implied Decimal Point (BCDTOR) (IB-560)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• 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
BCDTOR ExampleIn 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.
Parameter DL205 RangeValue (WORD BCD) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,P,K K0-9999; See DL205 V-memory map - Data WordsNumber of Decimal Points ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-4Result (DWORD REAL)⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data Words
DS5 Used
HPP N/A
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-258
Chapter 5: Standard RLL Instructions
Double BCD to Real with Implied Decimal Point (BCDTORD) (IB-562)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
BCDTORD Parameters• Value (DWORD BCD): specifies the
Dword 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
BCDTORD ExampleIn 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 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.
Parameter DL205 RangeValue (DWORD BCD) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,P,K K0-99999999; See DL205 V-memory map - Data WordsNumber of Decimal Points ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-8Result (DWORD REAL)⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data Words
DS5 Used
HPP N/A
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-259
Chapter 5: Standard RLL Instructions
Math - BCD (MATHBCD) (IB-521)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• 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 DL205 RangeWORD Result ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsExpression ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ Text
DS5 Used
HPP N/A
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-260
Chapter 5: Standard RLL Instructions
MATHBCD ExampleIn 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, 5th Edition, Rev. B 5-261
Chapter 5: Standard RLL Instructions
Math - Binary (MATHBIN) (IB-501)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• 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 DL205 RangeWORD Result ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsExpression ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ Text
DS5 Used
HPP N/A
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-262
Chapter 5: Standard RLL Instructions
MATHBIN ExampleIn 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, 5th Edition, Rev. B 5-263
Chapter 5: Standard RLL Instructions
Math - Real (MATHR) (IB-541)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 D2-260 and D2-262 also support 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.
MATHR ExampleIn 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.
Parameter DL205 RangeDWORD Result ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsExpression ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ Text
DS5 Used
HPP N/A
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-264
Chapter 5: Standard RLL Instructions
Real to BCD with Implied Decimal Point and Rounding (RTOBCD) (IB-561)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.
RTOBCD Parameters• Value (DWORD Real): specifies the
Real Dword location or 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 WORD
• Result (WORD BCD): specifies the location where the rounded/implied decimal points BCD value will be placed
RTOBCD ExampleIn the following example, the RTOBCD instruction is used to convert the 32-bit REAL (floating point) data format in V3000 and V3001 to the 4-digit BCD data format and store in V2000 when C100 turns on.
K2 in the Number of Decimal Points implies the data will have two implied decimal points.
Parameter DL205 RangeValue (DWORD Real) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V,P,R R ; See DL205 V-memory map - Data WordsNumber of Decimal Points ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-4Result (WORD BCD) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data Words
DS5 Used
HPP N/A
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-265
Chapter 5: Standard RLL Instructions
Real to Double BCD with Implied Decimal Point and Rounding (RTOBCDD) (IB-563)
Real to Double BCD with Implied Decimal Point and Rounding converts the absolute value of the given Real number to an 8-digit DWORD BCD number, compensating for an implied number of decimal points (K0-K8) and performs rounding.
For example, RTOBCDD R38156.74 with an implied number of decimal points equal to K1, would yield 381567 BCD. If the implied number of decimal points was 0, then the function would yield 38157 BCD (note that it rounded up).
If the Real number is negative, the Result will equal its positive, absolute value.
RTOBCDD Parameters• 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
• Result (DWORD BCD): specifies the location where the rounded/implied decimal points DWORD BCD value will be placed
RTOBCDD ExampleIn 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.
K2 in the Number of Decimal Points implies the data will have two implied decimal points.
DS5 Used
HPP N/A
Parameter DL205 RangeValue (DWORD Real) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V,P,R R ; See DL205 V-memory map - Data WordsNumber of Decimal Points ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-8Result (DWORD BCD) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data Words
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-266
Chapter 5: Standard RLL 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.
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
SQUARE ExampleIn 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.
DS5 Used
HPP N/A
Parameter DL205 RangeValue (WORD BCD) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,P,K K0-9999 ; See DL205 V-memory map - Data WordsResult (DWORD BCD) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data Words
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-267
Chapter 5: Standard RLL Instructions
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.
SQUAREB Parameters• Value (WORD Binary): specifies the
binary Word or constant that will be squared
• Result (DWORD Binary): specifies the location where the squared DWORD binary value will be placed
SQUAREB ExampleIn 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.
DS5 Used
HPP N/A
Parameter DL205 RangeValue (WORD Binary) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,P,K K0-65535; See DL205 V-memory map - Data WordsResult (DWORD Binary) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data Words
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-268
Chapter 5: Standard RLL Instructions
Square Real (SQUARER) (IB-543)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
SQUARER ExampleIn 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.
DS5 Used
HPP N/A
Parameter DL205 RangeValue (REAL DWORD) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V,P,R R ; See DL205 V-memory map - Data WordsResult (REAL DWORD)⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data Words
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-269
Chapter 5: Standard RLL Instructions
Sum BCD Numbers (SUMBCD) (IB-522)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 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
SUMBCD ExampleIn 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.
DS5 Used
HPP N/A
Parameter DL205 RangeStart Address ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsEnd Address (inclusive) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsResult (DWORD BCD) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data Words
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-270
Chapter 5: Standard RLL Instructions
Sum Binary Numbers (SUMBIN) (IB-502)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 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
SUMBIN ExampleIn 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.
DS5 Used
HPP N/A
Parameter DL205 RangeStart Address ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsEnd Address (inclusive) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsResult (DWORD Binary) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data Words
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-271
Chapter 5: Standard RLL Instructions
Sum Real Numbers (SUMR) (IB-542)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 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 DL205 RangeStart Address (DWORD) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsEnd Address (inclusive DWORD) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsResult (DWORD) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data Words
DS5 Used
HPP N/A
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-272
Chapter 5: Standard RLL Instructions
SUMR ExampleIn the following example, the SUMR instruction is used to total the sum of all floating point REAL number values in words V2000 thru V2007 and store the resulting 32-bit floating point REAL number value in V3000 and V3001 when C100 turns on.
DL205 User Manual, 5th Edition, Rev. B 5-273
Chapter 5: Standard RLL Instructions
ECOM100 Configuration (ECOM100) (IB-710)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 which PLC slot is occupied by the ECOM100 module.
• 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.
DS5 Used
HPP N/A
Parameter DL205 RangeECOM100# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Slot ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-7Status ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsWorkspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsMsg Buffer (65 words used) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data Words
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-274
Chapter 5: Standard RLL Instructions
ECOM100 ExampleThe ECOM100 Config IBox coordinates all of the interaction with other ECOM100-based IBoxes (ECxxxx). You must have an ECOM100 Config IBox for each ECOM100 module in your system. Configuration IBoxes must be at the top of your program and must execute every scan.
This IBox defines ECOM100# K0 to be in slot 3. Any ECOM100 IBoxes that need to reference this specific module (such as ECEMAIL, ECRX, ...) would enter K0 for their ECOM100# parameter.
The Status register is for reporting any completion or error information to other ECOM100 IBoxes. This V-memory register must not be used anywhere else in the entire program.
The Workspace register is used to maintain state information about the ECOM100, along with proper sharing and interlocking with the other ECOM100 IBoxes in the program. This V-memory register must not be used anywhere else in the entire program.
The Message Buffer of 65 words (130 bytes) is a common pool of memory that is used by other ECOM100 IBoxes (such as ECEMAIL). This way, you can have a bunch of ECEMAIL IBoxes, but only need 1 common buffer for generating and sending each EMail. These V-memory registers must not be used anywhere else in your entire program.
NOTE: An ECOM100 IBox instruction is used without a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
No permissive contact or input logic is used with this instruction
DL205 User Manual, 5th Edition, Rev. B 5-275
Chapter 5: Standard RLL Instructions
ECOM100 Disable DHCP (ECDHCPD) (IB-736)ECOM100 Disable DHCP will set up the ECOM100 to use its internal TCP/IP settings on a leading edge transition to the IBox. To configure the ECOM100’s TCP/IP settings manually, use the NetEdit3 utility, or you can do it programmatically from your PLC program using the ECOM100 IP Setup (ECIPSUP), or the individual ECOM100 IBoxes: ECOM Write IP Address (ECWRIP), ECOM Write Gateway Address (ECWRGWA), and ECOM100 Write Subnet Mask (ECWRSNM).
The Workspace parameter is an internal, private register used by this IBox and MUST BE UNIQUE in this one instruction and MUST NOT be used anywhere else in your program.
Either the Success or Error bit parameter will turn on once the command is complete. If there is an error, the Error Code parameter will report an ECOM100 error code (less than 100), or a PLC logic error (greater than 1000).
The “Disable DHCP” setting is stored in Flash-ROM in the ECOM100 and the execution of this IBox will disable the ECOM100 module for at least a half second until it writes the Flash-ROM. Therefore, it is HIGHLY RECOMMENDED that you only execute this IBox ONCE, on the second scan. Since it requires a LEADING edge to execute, use a NORMALLY CLOSED SP0 (STR NOT First Scan) to drive the power flow to the IBox.
In order for this ECOM100 IBox to function, you must turn ON dip switch 7 on the ECOM100 circuit board.
ECDHCPD 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
• Workspace: specifies a V-memory location that will be used by the instruction
• Success: specifies a bit that will turn on once the request is completed successfully
• Error: specifies a bit that will turn on if the instruction is not completed successfully
• Error Code: specifies the location where the Error Code will be written
Parameter DL205 RangeECOM100# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Workspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError Code ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data Words
DS5 Used
HPP N/A
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-276
Chapter 5: Standard RLL Instructions
ECDHCPD ExampleRung 1: The ECOM100 Config IBox is responsible for coordination/interlocking of all ECOM100 type IBoxes for one specific ECOM100 module. Tag the ECOM100 in slot 1 as ECOM100# K0. All other ECxxxx IBoxes refer to this module # as K0. If you need to move the module in the base to a different slot, then you only need to change this one IBox. V400 is used as a global result status register for the other ECxxxx IBoxes using this specific ECOM100 module. V401 is used to coordinate/interlock the logic in all of the other ECxxxx IBoxes using this specific ECOM100 module. V402-V502 is a common 130-byte buffer available for use by the other ECxxxx IBoxes using this specific ECOM100 module.
NOTE: An ECOM100 IBox instruction is used without a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
Rung 2: On the 2nd scan, disable DHCP in the ECOM100. DHCP is the same protocol used by PCs for using a DHCP Server to automatically assign the ECOM100’s IP Address, Gateway Address, and Subnet Mask. Typically disabling DHCP is done by assigning a hard-coded IP Address either in NetEdit or using one of the ECOM100 IP Setup IBoxes, but this IBox allows you to disable DHCP in the ECOM100 using your ladder program. The ECDHCPD is leading edge triggered, not power-flow driven (similar to a counter input leg). The command to disable DHCP will be sent to the ECOM100 whenever the power flow into the IBox goes from OFF to ON. If successful, turn on C100. If there is a failure, turn on C101. If it fails, you can look at V2000 for the specific error code.
ECOM100 ConfigECOM100 IB-710
ECOM100#SlotStatusWorkspaceMsg Buffer (65 WORDs)
K0K1
V400V401
V402-502
1
DL205 User Manual, 5th Edition, Rev. B 5-277
Chapter 5: Standard RLL Instructions
ECOM100 Enable DHCP (ECDHCPE) (IB-735)ECOM100 Enable DHCP will tell the ECOM100 to obtain its TCP/IP setup from a DHCP Server on a leading edge transition to the IBox.
The IBox will be successful once the ECOM100 has received its TCP/IP settings from the DHCP server. Since it is possible for the DHCP server to be unavailable, a Timeout parameter is provided so that the IBox can complete, but with an Error (Error Code = 1004 decimal).
See also the ECOM100 IP Setup (ECIPSUP) IBox 717 to directly set up ALL of the TCP/IP parameters in a single instruction - IP Address, Subnet Mask, and Gateway Address.
The Workspace parameter is an internal, private register used by this IBox and MUST BE UNIQUE in this one instruction and MUST NOT be used anywhere else in your program.
Either the Success or Error bit parameter will turn on once the command is complete. If there is an error, the Error Code parameter will report an ECOM100 error code (less than 100), or a PLC logic error (greater than 1000).
The “Enable DHCP” setting is stored in Flash-ROM in the ECOM100 and the execution of this IBox will disable the ECOM100 module for at least a half second until it writes the Flash-ROM. Therefore, it is HIGHLY RECOMMENDED that you only execute this IBox ONCE, on the second scan. Since it requires a LEADING edge to execute, use a NORMALLY CLOSED SP0 (STR NOT First Scan) to drive the power flow to the IBox.
In order for this ECOM100 IBox to function, you must turn ON dip switch 7 on the ECOM100 circuit board.
ECDHCPE 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.
• Timeout(sec): specifies a timeout period so that the instruction may have time to complete.
• Workspace: specifies a V-memory location that will be used by the instruction.
• Success: specifies a bit that will turn on once the request is completed successfully.
• Error: specifies a bit that will turn on if the instruction is not completed successfully.• Error Code: specifies the location where the Error Code will be written.
Parameter DL205 RangeECOM100# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Timeout (sec) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K5-127Workspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError Code ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data Words
DS5 Used
HPP N/A
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-278
Chapter 5: Standard RLL Instructions
ECDHCPE ExampleRung 1: The ECOM100 Config IBox is responsible for coordination/interlocking of all ECOM100 type IBoxes for one specific ECOM100 module. Tag the ECOM100 in slot 1 as ECOM100# K0. All other ECxxxx IBoxes refer to this module # as K0. If you need to move the module in the base to a different slot, then you only need to change this one IBox. V400 is used as a global result status register for the other ECxxxx IBoxes using this specific ECOM100 module.V401 is used to coordinate/interlock the logic in all of the other ECxxxx IBoxes using this specific ECOM100 module. V402-V502 is a common 130-byte buffer available for use by the other ECxxxx IBoxes using this specific ECOM100 module.
NOTE: An ECOM100 IBox instruction is used without a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
Rung 2: On the second scan, enable DHCP in the ECOM100. DHCP is the same protocol used by PCs for using a DHCP Server to automatically assign the ECOM100’s IP Address, Gateway Address, and Subnet Mask. Typically this is done using NetEdit, but this IBox allows you to enable DHCP in the ECOM100 using your ladder program. The ECDHCPE is leading edge triggered, not power-flow driven (similar to a counter input leg). The commands to enable DHCP will be sent to the ECOM100 whenever the power flow into the IBox goes from OFF to ON. The ECDHCPE does more than just set the bit to enable DHCP in the ECOM100, it polls the ECOM100 once every second to see if the ECOM100 has found a DHCP server and has a valid IP Address. Therefore, a timeout parameter is needed in case the ECOM100 cannot find a DHCP server. If a timeout does occur, the Error bit will turn on and the error code will be 1005 decimal. The Success bit will turn on only if the ECOM100 finds a DHCP Server and is assigned a valid IP Address. If successful, turn on C100. If there is a failure, turn on C101. If it fails, you can look at V2000 for the specific error code.
ECOM100 ConfigECOM100 IB-710
ECOM100#SlotStatusWorkspaceMsg Buffer (65 WORDs)
K0K1
V400V401
V402-502
1
DL205 User Manual, 5th Edition, Rev. B 5-279
Chapter 5: Standard RLL Instructions
ECOM100 Query DHCP Setting (ECDHCPQ) (IB-734)ECOM100 Query DHCP Setting will determine if DHCP is enabled in the ECOM100 on a leading edge transition to the IBox. The DHCP Enabled bit parameter will be ON if DHCP is enabled, OFF if disabled.
The Workspace parameter is an internal, private register used by this IBox and MUST BE UNIQUE in this one instruction and MUST NOT be used anywhere else in your program.
Either the Success or Error bit parameter will turn on once the command is complete.
In order for this ECOM100 IBox to function, you must turn ON dip switch 7 on the ECOM100 circuit board.
ECDHCPQ 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.
• Workspace: specifies a V-memory location that will be used by the instruction.
• Success: specifies a bit that will turn on once the instruction is completed successfully.
• Error: specifies a bit that will turn on if the instruction is not completed successfully.• DHCP Enabled: specifies a bit that will turn on if the ECOM100’s DHCP is enabled
or remain off if disabled - after instruction query, be sure to check the state of the Success/Error bit state along with DHCP Enabled bit state to confirm a successful module query.
Parameter DL205 RangeECOM100# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Workspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapDHCP Enabled ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory map
DS5 Used
HPP N/A
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-280
Chapter 5: Standard RLL Instructions
ECDHCPQ ExampleRung 1: The ECOM100 Config IBox is responsible for coordination/interlocking of all ECOM100 type IBoxes for one specific ECOM100 module. Tag the ECOM100 in slot 1 as ECOM100# K0. All other ECxxxx IBoxes refer to this module # as K0. If you need to move the module in the base to a different slot, then you only need to change this one IBox. V400 is used as a global result status register for the other ECxxxx IBoxes using this specific ECOM100 module.V401 is used to coordinate/interlock the logic in all of the other ECxxxx IBoxes using this specific ECOM100 module. V402-V502 is a common 130-byte buffer available for use by the other ECxxxx IBoxes using this specific ECOM100 module.
NOTE: An ECOM100 IBox instruction is used without a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
Rung 2: On the second scan, read whether DHCP is enabled or disabled in the ECOM100 and store it in C5. DHCP is the same protocol used by PCs for using a DHCP Server to automatically assign the ECOM100’s IP Address, Gateway Address, and Subnet Mask. The ECDHCPQ is leading edge triggered, not power-flow driven (similar to a counter input leg). The command to read (Query) whether DHCP is enabled or not will be sent to the ECOM100 whenever the power flow into the IBox goes from OFF to ON. If successful, turn on C100. If there is a failure, turn on C101.
ECOM100 ConfigECOM100 IB-710
ECOM100#SlotStatusWorkspaceMsg Buffer (65 WORDs)
K0K1
V400V401
V402-502
1
DL205 User Manual, 5th Edition, Rev. B 5-281
Chapter 5: Standard RLL Instructions
ECOM100 Send E-mail (ECEMAIL) (IB-711)ECOM100 Send EMail, on a leading edge transition, will behave as an EMail client and send an SMTP request to your SMTP Server to send the EMail message to the EMail addresses in the To: field and also to those listed in the Cc: list hard coded in the ECOM100. It will send the SMTP request based on the specified ECOM100#, which corresponds to a specific unique ECOM100 Configuration (ECOM100) at the top of your program.
The Body: field supports what the PRINT and VPRINT instructions support for text and embedded variables, allowing you to embed real-time data in your EMail (e.g., “V2000 = “ V2000:B).
The Workspace parameter is an internal, private register used by this IBox and MUST BE UNIQUE in this one instruction and MUST NOT be used anywhere else in your program.
Either the Success or Error bit parameter will turn on once the request is complete. If there is an error, the Error Code parameter will report an ECOM100 error code (less than 100), an SMPT protocol error (between 100 and 999), or a PLC logic error (greater than 1000).
Since the ECOM100 is only an EMail Client and requires access to an SMTP Server, you MUST have the SMTP parameters configured properly in the ECOM100 via the ECOM100’s Home Page and/or the EMail Setup instruction (ECEMSUP). To get to the ECOM100’s Home Page, use your favorite Internet browser and browse to the ECOM100’s IP Address, e.g., http://192.168.12.86
You are limited to approximately 100 characters of message data for the entire instruction, including the To: Subject: and Body: fields. To save space, the ECOM100 supports a hard coded list of EMail addresses for the Carbon Copy field (cc:) so that you can configure those IN the ECOM100, and keep the To: field small (or even empty), to leave more room for the Subject: and Body: fields.
In order for this ECOM100 IBox to function, you must turn ON dip switch 7 on the ECOM100 circuit board.
DS5 Used
HPP N/A
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-282
Chapter 5: Standard RLL Instructions
ECEMAIL 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
• Workspace: specifies a V-memory location that will be used by the instruction• Success: specifies a bit that will turn on once the request is completed successfully• Error: specifies a bit that will turn on if the instruction is not completed successfully• Error Code: specifies the location where the Error Code will be written• To: specifies an E-mail address that the message will be sent to• Subject: subject of the e-mail message• Body: supports what the PRINT and VPRINT instructions support for text and
embedded variables, allowing you to embed real-time data in the EMail message
Parameter DL205 RangeECOM100# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Workspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError Code ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory mapTo: ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ TextSubject: ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ TextBody: ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ See PRINT and VPRINT instructions
DL205 User Manual, 5th Edition, Rev. B 5-283
Chapter 5: Standard RLL Instructions
ECEMAIL Decimal Status CodesThis list of status codes is based on the list in the ECOM100 Mock Slave Address 89 Command Specification.
ECOM100 Status codes can be classified into four different areas based on its decimal value.
ECOM100 Status Code AreasError Description
0-1 Normal Status - no error2-99 Internal ECOM100 errors100-999 Standard TCP/IP protocol errors (SMTP, HTTP, etc)1000+ IBox ladder logic assigned errors (SP Slot Error, etc)
For the ECOM100 Send EMail IBOX, the status codes below are specific to this IBox.
Normal Status 0-1
ECOMM100 Send EMAIL IBOX Status CodesError Description
0-1 Success - ECEMAIL completed successfully.
1 Busy - ECEMAIL IBOX logic sets the Error register to this value when the ECEMAIL starts a new request.
Internal ECOM100 Errors (2-99)
Internal ECOM 100 Errors (2-99)Error Description
10-19 Timeout Errors - last digit shows where in ECOM100’s SMTP state logic the timeout occurred; regardless of the last digit, the SMTP conversation with the SMTP Server timed out.SMTP Internal Errors (20-29)
20 TCP Write Error21 No Sendee22 Invalid State23 Invalid Data24 Invalid SMTP Configuration25 Memory Allocation Error
ECEMAIL IBox Ladder Logic Assigned Errors (1000+)
ECEMAIL IBox Ladder Logic Assigned Errors (1000+)Error Description
101 SP Slot Error - the SP error bit for the ECOM100’s slot turned on. Possibly using RX or WX instructions on the ECOM100 and walking on the ECEMAIL execution. Use should use ECRX and ECX IBoxes,
DL205 User Manual, 5th Edition, Rev. B5-284
Chapter 5: Standard RLL Instructions
SMTP Protocol Errors - SMTP (100-999) Error Description
1xx Informational replies2xx Success replies200 (Non-standard success response)211 System status or system help reply214 Help message220 <domain> Service ready. Ready to start TLS221 <domain> Service closing transmission channel250 Ok, queuing for node <node> started. Requested mail action okay, completed251 Ok, no messages waiting for node <node>. User not local; will forward to <forward-path>
252 OK, pending messages for node <node> started. Cannot VRFY user (e.g., info is not local), but will take message for this user and attempt delivery.
253 OK, messages pending messages for node <node> started3xx` (re) direction replies354 Start mail input; end with <CRLF>.<CRLF>355 Octet-offset is the transaction offset.4xx client/request error replies421 <domain> Service not available, closing transmission channel432 A password transition is needed450 Requested mail action not taken: mailbox unavailable. ATRN request refused.451 Requested action aborted; local error in processing. Unable to process ATRN request now.452 Requested action not taken: insufficient system storage453 You have no mail
454 TLS is not available due to temporary reason. Encryption required for requested authentication mechanism.
458 Unable to queue messages for node <node>459 Node <node> not allowed: <reason>5xx Server/process error replies500 Syntax error, command unrecognized. Syntax error.501 Syntax error in parameters or arguments502 Command not implemented503 Bad sequence of commands504 Command parameter not implemented521 <domain> does not accept mail
530 Access denied. Must issue a STARTTLS command first. Encryption required for requested authentication mechanism.
Continued next page
ECEMAIL Decimal Status CodesSMTP Protocol Errors - SMTP (100-999)
DL205 User Manual, 5th Edition, Rev. B 5-285
Chapter 5: Standard RLL Instructions
SMTP Protocol Errors - SMTP (100-999) Error Description
534 Authentication mechanism is too weak.538 Encryption required for requested authentication mechanism.550 Requested action not taken; mailbox unavailable.551 User not local; please try <forward path>552 Requested mail action aborted; exceeded storage allocation553 Requested action not taken; mailbox name not allowed.554 Transaction failed
DL205 User Manual, 5th Edition, Rev. B5-286
Chapter 5: Standard RLL Instructions
ECOM100 ConfigECOM100 IB-710
ECOM100#SlotStatusWorkspaceMsg Buffer (65 WORDs)
K0K1
V400V401
V402-502
1
Rung 2: When a machine goes down, send an email to Joe in maintenance and to the VP over production showing what machine is down along with the date/time stamp of when it went down.
The ECEMAIL is leading edge triggered, not power-flow driven (similar to a counter input leg). An email will be sent whenever the power flow into the IBox goes from OFF to ON. This helps prevent self-inflicted spamming.
If the EMail is sent, turn on C100. If there is a failure, turn on C101. If it fails, you can look at V2000 for the SMTP error code or other possible error codes.
ECEMAIL ExampleRung 1: The ECOM100 Config IBox is responsible for coordination/interlocking of all ECOM100 type IBoxes for one specific ECOM100 module. Tag the ECOM100 in slot 1 as ECOM100# K0. All other ECxxxx IBoxes refer to this module # as K0. If you need to move the module in the base to a different slot, then you only need to change this one IBox. V400 is used as a global result status register for the other ECxxxx IBoxes using this specific ECOM100 module.V401 is used to coordinate/interlock the logic in all of the other ECxxxx IBoxes using this specific ECOM100 module. V402-V502 is a common 130-byte buffer available for use by the other ECxxxx IBoxes using this specific ECOM100 module.
NOTE: An ECOM100 IBox instruction is used without a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
DL205 User Manual, 5th Edition, Rev. B 5-287
Chapter 5: Standard RLL Instructions
ECOM100 Restore Default E-mail Setup (ECEMRDS) (IB-713)ECOM100 Restore Default EMail Setup, on a leading edge transition, will restore the original EMail Setup data stored in the ECOM100 back to the working copy based on the specified ECOM100#, which corresponds to a specific unique ECOM100 Configuration (ECOM100) at the top of your program.
When the ECOM100 is first powered up, it copies the EMail setup data stored in ROM to the working copy in RAM. You can then modify this working copy from your program using the ECOM100 EMail Setup (ECEMSUP) IBox. After modifying the working copy, you can later restore the original setup data via your program by using this IBox.
The Workspace parameter is an internal, private register used by this IBox and MUST BE UNIQUE in this one instruction and MUST NOT be used anywhere else in your program.
Either the Success or Error bit parameter will turn on once the command is complete. If there is an error, the Error Code parameter will report an ECOM100 error code (less than 100), or a PLC logic error (greater than 1000).
In order for this ECOM100 IBox to function, you must turn ON dip switch 7 on the ECOM100 circuit board.
ECEMRDS 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
• Workspace: specifies a V-memory location that will be used by the instruction• Success: specifies a bit that will turn on once the request is completed successfully• Error: specifies a bit that will turn on if the instruction is not completed successfully• Error Code: specifies the location where the Error Code will be written
DS5 Used
HPP N/A
Parameter DL205 RangeECOM100# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Workspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError Code ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data Words
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-288
Chapter 5: Standard RLL Instructions
ECEMRDS ExampleRung 1: The ECOM100 Config IBox is responsible for coordination/interlocking of all ECOM100 type IBoxes for one specific ECOM100 module. Tag the ECOM100 in slot 1 as ECOM100# K0. All other ECxxxx IBoxes refer to this module # as K0. If you need to move the module in the base to a different slot, then you only need to change this one IBox. V400 is used as a global result status register for the other ECxxxx IBoxes using this specific ECOM100 module.V401 is used to coordinate/interlock the logic in all of the other ECxxxx IBoxes using this specific ECOM100 module. V402-V502 is a common 130-byte buffer available for use by the other ECxxxx IBoxes using this specific ECOM100 module.
NOTE: An ECOM100 IBox instruction is used without a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
Rung 2: Whenever an EStop is pushed, ensure that the president of the company gets copies of all Emails being sent.
The ECOM100 EMail Setup IBox allows you to set/change the SMTP Email settings stored in the ECOM100.
(Example continued on next page)
ECOM100 ConfigECOM100 IB-710
ECOM100#SlotStatusWorkspaceMsg Buffer (65 WORDs)
K0K1
V400V401
V402-502
1
DL205 User Manual, 5th Edition, Rev. B 5-289
Chapter 5: Standard RLL Instructions
ECEMRDS Example (cont’d)Rung 3: Once the EStop is pulled out, take the president off the cc: list by restoring the default EMail setup in the ECOM100.
The ECEMRDS is leading edge triggered, not power-flow driven (similar to a counter input leg). The ROM-based EMail configuration stored in the ECOM100 will be copied over the “working copy” whenever the power flow into the IBox goes from OFF to ON (the working copy can be changed by using the ECEMSUP IBox).
If successful, turn on C102. If there is a failure, turn on C103. If it fails, you can look at V2001 for the specific error code.
DL205 User Manual, 5th Edition, Rev. B5-290
Chapter 5: Standard RLL Instructions
ECOM100 E-mail Setup (ECEMSUP) (IB-712)ECOM100 EMail Setup, on a leading edge transition, will modify the working copy of the EMail setup currently in the ECOM100 based on the specified ECOM100#, which corresponds to a specific unique ECOM100 Configuration (ECOM100) at the top of your program.
You may pick and choose any or all fields to be modified using this instruction. Note that these changes are cumulative: if you execute multiple ECOM100 EMail Setup IBoxes, then all of the changes are made in the order they are executed. Also note that you can restore the original ECOM100 EMail Setup that is stored in the ECOM100 to the working copy by using the ECOM100 Restore Default EMail Setup (ECEMRDS) IBox.
The Workspace parameter is an internal, private register used by this IBox and MUST BE UNIQUE in this one instruction and MUST NOT be used anywhere else in your program.
Either the Success or Error bit parameter will turn on once the command is complete. If there is an error, the Error Code parameter will report an ECOM100 error code (less than 100), or a PLC logic error (greater than 1000).
You are limited to approximately 100 characters/bytes of setup data for the entire instruction. So if needed, you could divide the entire setup across multiple ECEMSUP IBoxes on a field-by-field basis, for example do the Carbon Copy (cc:) field in one ECEMSUP IBox and the remaining setup parameters in another.
In order for this ECOM100 IBox to function, you must turn ON dip switch 7 on the ECOM100 circuit board.
ECEMSUP 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.
• Workspace: specifies a V-memory location that will be used by the instruction.• Success: specifies a bit that will turn on once the request is completed successfully.• Error: specifies a bit that will turn on if the instruction is not completed successfully.• Error Code: specifies the location where the Error Code will be written.• SMTP Server IP Addr: optional parameter that specifies the IP Address of the SMTP
Server on the ECOM100’s network.• Sender Name: optional parameter that specifies the sender name that will appear in the
“From:” field to those who receive the e-mail.• Sender EMail: optional parameter that specifies the sender EMail address that will appear
in the “From:” field to those who receive the e-mail.
DS5 Used
HPP N/A
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-291
Chapter 5: Standard RLL Instructions
ECEMSUP Parameters (cont’d)• Port Number: optional parameter that specifies the TCP/IP Port Number to send SMTP
requests; usually this does not need to be configured (see your network administrator for information on this setting).
• Timeout (sec): optional parameter that specifies the number of seconds to wait for the SMTP Server to send the EMail to all the recipients.
• Cc: optional parameter that specifies a list of “carbon copy” Email addresses to send all EMails to.
Parameter DL205 RangeECOM100# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Workspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError Code ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data Words
DL205 User Manual, 5th Edition, Rev. B5-292
Chapter 5: Standard RLL Instructions
ECEMSUP ExampleRung 1: The ECOM100 Config IBox is responsible for coordination/interlocking of all ECOM100 type IBoxes for one specific ECOM100 module. Tag the ECOM100 in slot 1 as ECOM100# K0. All other ECxxxx IBoxes refer to this module # as K0. If you need to move the module in the base to a different slot, then you only need to change this one IBox. V400 is used as a global result status register for the other ECxxxx IBoxes using this specific ECOM100 module.V401 is used to coordinate/interlock the logic in all of the other ECxxxx IBoxes using this specific ECOM100 module. V402-V502 is a common 130-byte buffer available for use by the other ECxxxx IBoxes using this specific ECOM100 module.
NOTE: An ECOM100 IBox instruction is used without a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
(Example continued on next page)
ECOM100 ConfigECOM100 IB-710
ECOM100#SlotStatusWorkspaceMsg Buffer (65 WORDs)
K0K1
V400V401
V402-502
1
DL205 User Manual, 5th Edition, Rev. B 5-293
Chapter 5: Standard RLL Instructions
ECEMSUP Example (cont’d)Rung 2: Whenever an EStop is pushed, ensure that president of the company gets copies of all EMails being sent.The ECOM100 EMail Setup IBox allows you to set/change the SMTP EMail settings stored in the ECOM100. The ECEMSUP is leading edge triggered, not power-flow driven (similar to a counter input leg). At power-up, the ROM-based EMail configuration stored in the ECOM100 is copied to a RAM-based “working copy”. You can change this working copy by using the ECEMSUP IBox. To restore the original ROM-based configuration, use the Restore Default EMail Setup ECEMRDS IBox.
If successful, turn on C100. If there is a failure, turn on C101. If it fails, you can look at V2000 for the specific error code.
Rung 3: Once the EStop is pulled out, take the president off the cc: list by restoring the default EMail setup in the ECOM100.
DL205 User Manual, 5th Edition, Rev. B5-294
Chapter 5: Standard RLL Instructions
ECOM100 IP Setup (ECIPSUP) (IB-717)ECOM100 IP Setup will configure the three TCP/IP parameters in the ECOM100: IP Address, Subnet Mask, and Gateway Address, on a leading edge transition to the IBox. The ECOM100 is specified by the ECOM100#, which corresponds to a specific unique ECOM100 Configuration (ECOM100) IBox at the top of your program.
The Workspace parameter is an internal, private register used by this IBox and MUST BE UNIQUE in this one instruction and MUST NOT be used anywhere else in your program.
Either the Success or Error bit parameter will turn on once the command is complete. If there is an error, the Error Code parameter will report an ECOM100 error code (less than 100), or a PLC logic error (greater than 1000).
This setup data is stored in Flash-ROM in the ECOM100 and will disable the ECOM100 module for at least a half second until it writes the Flash-ROM. Therefore, it is HIGHLY RECOMMENDED that you only execute this IBox ONCE on the second scan. Since it requires a LEADING edge to execute, use a NORMALLY CLOSED SP0 (NOT First Scan) to drive the power flow to the IBox.
In order for this ECOM100 IBox to function, you must turn ON dip switch 7 on the ECOM100 circuit board.
ECIPSUP 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.
• Workspace: specifies a V-memory location that will be used by the instruction.• Success: specifies a bit that will turn on once the request is completed successfully.• Error: specifies a bit that will turn on if the instruction is not completed successfully.• Error Code: specifies the location where the Error Code will be written.• IP Address: specifies the module’s IP Address.• Subnet Mask: specifies the Subnet Mask for the module to use.• Gateway Address: specifies the Gateway Address for the module to use.
DS5 Used
HPP N/A
Parameter DL205 RangeECOM100# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Workspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError Code ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsIP Address ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠IP Address 0.0.0.1. to 255.255.255.254Subnet Mask Address ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠IP Address Mask 0.0.0.1. to 255.255.255.254Gateway Address ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠IP Address 0.0.0.1. to 255.255.255.254
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-295
Chapter 5: Standard RLL Instructions
ECIPSUP ExampleRung 1: The ECOM100 Config IBox is responsible for coordination/interlocking of all ECOM100 type IBoxes for one specific ECOM100 module. Tag the ECOM100 in slot 1 as ECOM100# K0. All other ECxxxx IBoxes refer to this module # as K0. If you need to move the module in the base to a different slot, then you only need to change this one IBox. V400 is used as a global result status register for the other ECxxxx IBoxes using this specific ECOM100 module. V401 is used to coordinate/interlock the logic in all of the other ECxxxx IBoxes using this specific ECOM100 module. V402-V502 is a common 130-byte buffer available for use by the other ECxxxx IBoxes using this specific ECOM100 module.
NOTE: An ECOM100 IBox instruction is used without a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
Rung 2: On the second scan, configure all of the TCP/IP parameters in the ECOM100:
IP Address: 192.168.12.100
Subnet Mask: 255.255.0.0
Gateway Address: 192.168.0.1
The ECIPSUP is leading edge triggered, not power-flow driven (similar to a counter input leg). The command to write the TCP/IP configuration parameters will be sent to the ECOM100 whenever the power flow into the IBox goes from OFF to ON.
If successful, turn on C100. If there is a failure, turn on C101. If it fails, you can look at V2000 for the specific error code.
ECOM100 ConfigECOM100 IB-710
ECOM100#SlotStatusWorkspaceMsg Buffer (65 WORDs)
K0K1
V400V401
V402-502
1
DL205 User Manual, 5th Edition, Rev. B5-296
Chapter 5: Standard RLL Instructions
ECOM100 Read Description (ECRDDES) (IB-726)ECOM100 Read Description will read the ECOM100’s Description field up to the number of specified characters on a leading edge transition to the IBox.
The Workspace parameter is an internal, private register used by this IBox and MUST BE UNIQUE in this one instruction and MUST NOT be used anywhere else in your program.
Either the Success or Error bit parameter will turn on once the command is complete.
In order for this ECOM100 IBox to function, you must turn ON dip switch 7 on the ECOM100 circuit board.
ECRDDES 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
• Workspace: specifies a V-memory location that will be used by the instruction• Success: specifies a bit that will turn on once the request is completed successfully• Error: specifies a bit that will turn on if the instruction is not successfully completed• Description: specifies the starting buffer location where the ECOM100’s Description will
be placed• Num Chars: specifies the number of characters (bytes) to read from the ECOM100’s
Description field
DS5 Used
HPP N/A
Parameter DL205 RangeECOM100# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Workspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapDescription ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsNum Chars ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K1-128
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-297
Chapter 5: Standard RLL Instructions
ECRDDES ExampleRung 1: The ECOM100 Config IBox is responsible for coordination/interlocking of all ECOM100 type IBoxes for one specific ECOM100 module. Tag the ECOM100 in slot 1 as ECOM100# K0. All other ECxxxx IBoxes refer to this module # as K0. If you need to move the module in the base to a different slot, then you only need to change this one IBox. V400 is used as a global result status register for the other ECxxxx IBoxes using this specific ECOM100 module. V401 is used to coordinate/interlock the logic in all of the other ECxxxx IBoxes using this specific ECOM100 module. V402-V502 is a common 130-byte buffer available for use by the other ECxxxx IBoxes using this specific ECOM100 module.
NOTE: An ECOM100 IBox instruction is used without a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
Rung 2: On the 2nd scan, read the Module Description of the ECOM100 and store it in V3000 thru V3007 (16 characters). This text can be displayed by an HMI.
The ECRDDES is leading edge triggered, not power-flow driven (similar to a counter input leg). The command to read the module description will be sent to the ECOM100 whenever the power flow into the IBox goes from OFF to ON.
If successful, turn on C100. If there is a failure, turn on C101.
ECOM100 ConfigECOM100 IB-710
ECOM100#SlotStatusWorkspaceMsg Buffer (65 WORDs)
K0K1
V400V401
V402-502
1
DL205 User Manual, 5th Edition, Rev. B5-298
Chapter 5: Standard RLL Instructions
ECOM100 Read Gateway Address (ECRDGWA) (IB-730)ECOM100 Read Gateway Address will read the four parts of the Gateway IP address and store them in four consecutive V-memory locations in decimal format, on a leading edge transition to the IBox.
The Workspace parameter is an internal, private register used by this IBox and MUST BE UNIQUE in this one instruction and MUST NOT be used anywhere else in your program.
Either the Success or Error bit parameter will turn on once the command is complete.
In order for this ECOM100 IBox to function, you must turn ON dip switch 7 on the ECOM100 circuit board.
ECRDGWA 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.
• Workspace: specifies a V-memory location that will be used by the instruction.
• Success: specifies a bit that will turn on once the request is completed successfully.
• Error: specifies a bit that will turn on if the instruction is not completed successfully.• Gateway IP Addr: specifies the starting address where the ECOM100’s Gateway Address
will be placed in 4 consecutive V-memory locations.
DS5 Used
HPP N/A
Parameter DL205 RangeECOM100# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Workspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapGateway IP Address (4 Words) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data Words
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-299
Chapter 5: Standard RLL Instructions
ECRDGWA ExampleRung 1: The ECOM100 Config IBox is responsible for coordination/interlocking of all ECOM100 type IBoxes for one specific ECOM100 module. Tag the ECOM100 in slot 1 as ECOM100# K0. All other ECxxxx IBoxes refer to this module # as K0. If you need to move the module in the base to a different slot, then you only need to change this one IBox. V400 is used as a global result status register for the other ECxxxx IBoxes using this specific ECOM100 module. V401 is used to coordinate/interlock the logic in all of the other ECxxxx IBoxes using this specific ECOM100 module. V402-V502 is a common 130-byte buffer available for use by the other ECxxxx IBoxes using this specific ECOM100 module.
NOTE: An ECOM100 IBox instruction is used without a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
Rung 2: On the second scan, read the Gateway Address of the ECOM100 and store it in V3000 thru V3003 (4 decimal numbers). The ECOM100’s Gateway Address could be displayed by an HMI.
The ECRDGWA is leading edge triggered, not power-flow driven (similar to a counter input leg). The command to read the Gateway Address will be sent to the ECOM100 whenever the power flow into the IBox goes from OFF to ON.
If successful, turn on C100. If there is a failure, turn on C101.
ECOM100 ConfigECOM100 IB-710
ECOM100#SlotStatusWorkspaceMsg Buffer (65 WORDs)
K0K1
V400V401
V402-502
1
DL205 User Manual, 5th Edition, Rev. B5-300
Chapter 5: Standard RLL Instructions
ECOM100 Read IP Address (ECRDIP) (IB-722)ECOM100 Read IP Address will read the four parts of the IP address and store them in four consecutive V-memory locations in decimal format, on a leading edge transition to the IBox.
The Workspace parameter is an internal, private register used by this IBox and MUST BE UNIQUE in this one instruction and MUST NOT be used anywhere else in your program.
Either the Success or Error bit parameter will turn on once the command is complete.
In order for this ECOM100 IBox to function, you must turn ON dip switch 7 on the ECOM100 circuit board.
ECRDIP 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
• Workspace: specifies a V-memory location that will be used by the instruction
• Success: specifies a bit that will turn on once the request is completed successfully
• Error: specifies a bit that will turn on if the instruction is not completed successfully• IP Address: specifies the starting address where the ECOM100’s IP Address will be placed
in four consecutive V-memory locations
DS5 Used
HPP N/A
Parameter DL205 RangeECOM100# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Workspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapIP Address (4 Words) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data Words
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-301
Chapter 5: Standard RLL Instructions
ECRDIP ExampleRung 1: The ECOM100 Config IBox is responsible for coordination/interlocking of all ECOM100 type IBoxes for one specific ECOM100 module. Tag the ECOM100 in slot 1 as ECOM100# K0. All other ECxxxx IBoxes refer to this module # as K0. If you need to move the module in the base to a different slot, then you only need to change this one IBox. V400 is used as a global result status register for the other ECxxxx IBoxes using this specific ECOM100 module. V401 is used to coordinate/interlock the logic in all of the other ECxxxx IBoxes using this specific ECOM100 module. V402-V502 is a common 130-byte buffer available for use by the other ECxxxx IBoxes using this specific ECOM100 module.
NOTE: An ECOM100 IBox instruction is used without a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
Rung 2: On the second scan, read the IP Address of the ECOM100 and store it in V3000 thru V3003 (four decimal numbers). The ECOM100’s IP Address could be displayed by an HMI.
The ECRDIP is leading edge triggered, not power-flow driven (similar to a counter input leg). The command to read the IP Address will be sent to the ECOM100 whenever the power flow into the IBox goes from OFF to ON.
If successful, turn on C100. If there is a failure, turn on C101.
ECOM100 ConfigECOM100 IB-710
ECOM100#SlotStatusWorkspaceMsg Buffer (65 WORDs)
K0K1
V400V401
V402-502
1
DL205 User Manual, 5th Edition, Rev. B5-302
Chapter 5: Standard RLL Instructions
ECOM100 Read Module ID (ECRDMID) (IB-720)ECOM100 Read Module ID will read the binary (decimal) WORD sized Module ID on a leading edge transition to the IBox.
The Workspace parameter is an internal, private register used by this IBox and MUST BE UNIQUE in this one instruction and MUST NOT be used anywhere else in your program.
Either the Success or Error bit parameter will turn on once the command is complete.
In order for this ECOM100 IBox to function, you must turn ON dip switch 7 on the ECOM100 circuit board.
ECRDMID 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
• Workspace: specifies a V-memory location that will be used by the instruction
• Success: specifies a bit that will turn on once the request is completed successfully
• Error: specifies a bit that will turn on if the instruction is not completed successfully
• Module ID: specifies the location where the ECOM100’s Module ID (decimal) will be placed
DS5 Used
HPP N/A
Parameter DL205 RangeECOM100# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Workspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapModule ID⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data Words
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-303
Chapter 5: Standard RLL Instructions
ECRDMID ExampleRung 1: The ECOM100 Config IBox is responsible for coordination/interlocking of all ECOM100 type IBoxes for one specific ECOM100 module. Tag the ECOM100 in slot 1 as ECOM100# K0. All other ECxxxx IBoxes refer to this module # as K0. If you need to move the module in the base to a different slot, then you only need to change this one IBox. V400 is used as a global result status register for the other ECxxxx IBoxes using this specific ECOM100 module. V401 is used to coordinate/interlock the logic in all of the other ECxxxx IBoxes using this specific ECOM100 module. V402-V502 is a common 130-byte buffer available for use by the other ECxxxx IBoxes using this specific ECOM100 module.
NOTE: An ECOM100 IBox instruction is used without a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
Rung 2: On the second scan, read the Module ID of the ECOM100 and store it in V2000.
The ECRDMID is leading edge triggered, not power-flow driven (similar to a counter input leg). The command to read the module ID will be sent to the ECOM100 whenever the power flow into the IBox goes from OFF to ON.
If successful, turn on C100. If there is a failure, turn on C101.
ECOM100 ConfigECOM100 IB-710
ECOM100#SlotStatusWorkspaceMsg Buffer (65 WORDs)
K0K1
V400V401
V402-502
1
DL205 User Manual, 5th Edition, Rev. B5-304
Chapter 5: Standard RLL Instructions
ECOM100 Read Module Name (ECRDNAM) (IB-724)ECOM100 Read Name will read the Module Name up to the number of specified characters on a leading edge transition to the IBox.
The Workspace parameter is an internal, private register used by this IBox and MUST BE UNIQUE in this one instruction and MUST NOT be used anywhere else in your program.
Either the Success or Error bit parameter will turn on once the command is complete.
In order for this ECOM100 IBox to function, you must turn ON dip switch 7 on the ECOM100 circuit board.
ECRDNAM 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.
• Workspace: specifies a V-memory location that will be used by the instruction.
• Success: specifies a bit that will turn on once the request is completed successfully.
• Error: specifies a bit that will turn on if the instruction is not completed successfully.
• Module Name: specifies the starting buffer location where the ECOM100’s Module Name will be placed.
• Num Chars: specifies the number of characters (bytes) to read from the ECOM100’s Name field.
DS5 Used
HPP N/A
Parameter DL205 RangeECOM100# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Workspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapModule Name ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsNum Chars ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K1-128
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-305
Chapter 5: Standard RLL Instructions
ECRDNAM ExampleRung 1: The ECOM100 Config IBox is responsible for coordination/interlocking of all ECOM100 type IBoxes for one specific ECOM100 module. Tag the ECOM100 in slot 1 as ECOM100# K0. All other ECxxxx IBoxes refer to this module # as K0. If you need to move the module in the base to a different slot, then you only need to change this one IBox. V400 is used as a global result status register for the other ECxxxx IBoxes using this specific ECOM100 module. V401 is used to coordinate/interlock the logic in all of the other ECxxxx IBoxes using this specific ECOM100 module. V402-V502 is a common 130-byte buffer available for use by the other ECxxxx IBoxes using this specific ECOM100 module.
NOTE: An ECOM100 IBox instruction is used without a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
Rung 2: On the second scan, read the Module Name of the ECOM100 and store it in V3000 thru V3003 (8 characters). This text can be displayed by an HMI.
The ECRDNAM is leading edge triggered, not power-flow driven (similar to a counter input leg). The command to read the module name will be sent to the ECOM100 whenever the power flow into the IBox goes from OFF to ON.
If successful, turn on C100. If there is a failure, turn on C101.
ECOM100 ConfigECOM100 IB-710
ECOM100#SlotStatusWorkspaceMsg Buffer (65 WORDs)
K0K1
V400V401
V402-502
1
DL205 User Manual, 5th Edition, Rev. B5-306
Chapter 5: Standard RLL Instructions
ECOM100 Read Subnet Mask (ECRDSNM) (IB-732)ECOM100 Read Subnet Mask will read the four parts of the Subnet Mask and store them in 4 consecutive V-memory locations in decimal format, on a leading edge transition to the IBox.
The Workspace parameter is an internal, private register used by this IBox and MUST BE UNIQUE in this one instruction and MUST NOT be used anywhere else in your program.
Either the Success or Error bit parameter will turn on once the command is complete.
In order for this ECOM100 IBox to function, you must turn ON dip switch 7 on the ECOM100 circuit board.
ECRDSNM 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.
• Workspace: specifies a V-memory location that will be used by the instruction.
• Success: specifies a bit that will turn on once the request is completed successfully.
• Error: specifies a bit that will turn on if the instruction is not completed successfully.
• Subnet Mask: specifies the starting address where the ECOM100’s Subnet Mask will be placed in four consecutive V-memory locations.
DS5 Used
HPP N/A
Parameter DL205 RangeECOM100# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Workspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapSubnet Mask (4 Words) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data Words
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-307
Chapter 5: Standard RLL Instructions
ECRDSNM ExampleRung 1: The ECOM100 Config IBox is responsible for coordination/interlocking of all ECOM100 type IBoxes for one specific ECOM100 module. Tag the ECOM100 in slot 1 as ECOM100# K0. All other ECxxxx IBoxes refer to this module # as K0. If you need to move the module in the base to a different slot, then you only need to change this one IBox. V400 is used as a global result status register for the other ECxxxx IBoxes using this specific ECOM100 module. V401 is used to coordinate/interlock the logic in all of the other ECxxxx IBoxes using this specific ECOM100 module. V402-V502 is a common 130-byte buffer available for use by the other ECxxxx IBoxes using this specific ECOM100 module.
NOTE: An ECOM100 IBox instruction is used without a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
Rung 2: On the second scan, read the Subnet Mask of the ECOM100 and store it in V3000 thru V3003 (4 decimal numbers). The ECOM100’s Subnet Mask could be displayed by an HMI.
The ECRDSNM is leading edge triggered, not power-flow driven (similar to a counter input leg). The command to read the Subnet Mask will be sent to the ECOM100 whenever the power flow into the IBox goes from OFF to ON.
If successful, turn on C100. If there is a failure, turn on C101.
ECOM100 ConfigECOM100 IB-710
ECOM100#SlotStatusWorkspaceMsg Buffer (65 WORDs)
K0K1
V400V401
V402-502
1
DL205 User Manual, 5th Edition, Rev. B5-308
Chapter 5: Standard RLL Instructions
ECOM100 Write Description (ECWRDES) (IB-727)ECOM100 Write Description will write the given Description to the ECOM100 module on a leading edge transition to the IBox. If you use a dollar sign ($) or double quote (“), use the PRINT/VPRINT escape sequence of TWO dollar signs ($$) for a single dollar sign or dollar sign-double quote ($”) for a double quote character.
The Workspace parameter is an internal, private register used by this IBox and MUST BE UNIQUE in this one instruction and MUST NOT be used anywhere else in your program.
Either the Success or Error bit parameter will turn on once the command is complete. If there is an error, the Error Code parameter will report an ECOM100 error code (less than 100), or a PLC logic error (greater than 1000).
The Description is stored in Flash-ROM in the ECOM100 and the execution of this IBox will disable the ECOM100 module for at least a half second until it writes the Flash-ROM. Therefore, it is HIGHLY RECOMMENDED that you only execute this IBox ONCE on the second scan. Since it requires a LEADING edge to execute, use a NORMALLY CLOSED SP0 (STR NOT First Scan) to drive the power flow to the IBox.
In order for this ECOM100 IBox to function, you must turn ON dip switch 7 on the ECOM100 circuit board.
ECWRDES 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
• Workspace: specifies a V-memory location that will be used by the instruction
• Success: specifies a bit that will turn on once the request is completed successfully
• Error: specifies a bit that will turn on if the instruction is not completed successfully
• Error Code: specifies the location where the Error Code will be written• Description: specifies the Description that will be written to the module
DS5 Used
HPP N/A
Parameter DL205 RangeECOM100# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Workspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError Code ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsDescription ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ Text
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-309
Chapter 5: Standard RLL Instructions
ECWRDES ExampleRung 1: The ECOM100 Config IBox is responsible for coordination/interlocking of all ECOM100 type IBoxes for one specific ECOM100 module. Tag the ECOM100 in slot 1 as ECOM100# K0. All other ECxxxx IBoxes refer to this module # as K0. If you need to move the module in the base to a different slot, then you only need to change this one IBox. V400 is used as a global result status register for the other ECxxxx IBoxes using this specific ECOM100 module. V401 is used to coordinate/interlock the logic in all of the other ECxxxx IBoxes using this specific ECOM100 module. V402-V502 is a common 130-byte buffer available for use by the other ECxxxx IBoxes using this specific ECOM100 module.
NOTE: An ECOM100 IBox instruction is used without a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
Rung 2: On the second scan, set the Module Description of the ECOM100. Typically this is done using NetEdit, but this IBox allows you to configure the module description in the ECOM100 using your ladder program.
The ECWRDES is leading edge triggered, not power-flow driven (similar to a counter input leg). The command to write the module description will be sent to the ECOM100 whenever the power flow into the IBox goes from OFF to ON.
If successful, turn on C100. If there is a failure, turn on C101. If it fails, you can look at V2000 for the specific error code.
ECOM100 ConfigECOM100 IB-710
ECOM100#SlotStatusWorkspaceMsg Buffer (65 WORDs)
K0K1
V400V401
V402-502
1
DL205 User Manual, 5th Edition, Rev. B5-310
Chapter 5: Standard RLL Instructions
ECOM100 Write Gateway Address (ECWRGWA) (IB-731)ECOM100 Write Gateway Address will write the given Gateway IP Address to the ECOM100 module on a leading edge transition to the IBox. See also ECOM100 IP Setup (ECIPSUP) IBox 717 to set up ALL of the TCP/IP parameters in a single instruction - IP Address, Subnet Mask, and Gateway Address.
The Workspace parameter is an internal, private register used by this IBox and MUST BE UNIQUE in this one instruction and MUST NOT be used anywhere else in your program.
Either the Success or Error bit parameter will turn on once the command is complete. If there is an error, the Error Code parameter will report an ECOM100 error code (less than 100), or a PLC logic error (greater than 1000).
The Gateway Address is stored in Flash-ROM in the ECOM100 and the execution of this IBox will disable the ECOM100 module for at least a half second until it writes the Flash-ROM. Therefore, it is HIGHLY RECOMMENDED that you only execute this IBox ONCE, on the second scan. Since it requires a LEADING edge to execute, use a NORMALLY CLOSED SP0 (STR NOT First Scan) to drive the power flow to the IBox.
In order for this ECOM100 IBox to function, you must turn ON dip switch 7 on the ECOM100 circuit board.
ECWRGWA 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
• Workspace: specifies a V-memory location that will be used by the instruction
• Success: specifies a bit that will turn on once the request is completed successfully
• Error: specifies a bit that will turn on if the instruction is not completed successfully• Error Code: specifies the location where the Error Code will be written• Gateway Address: specifies the Gateway IP Address that will be written to the module
DS5 Used
HPP N/A
Parameter DL205 RangeECOM100# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Workspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError Code ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsGateway Address ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ 0.0.0.1. to 255.255.255.254
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-311
Chapter 5: Standard RLL Instructions
ECWRGWA ExampleRung 1: The ECOM100 Config IBox is responsible for coordination/interlocking of all ECOM100 type IBoxes for one specific ECOM100 module. Tag the ECOM100 in slot 1 as ECOM100# K0. All other ECxxxx IBoxes refer to this module # as K0. If you need to move the module in the base to a different slot, then you only need to change this one IBox. V400 is used as a global result status register for the other ECxxxx IBoxes using this specific ECOM100 module. V401 is used to coordinate/interlock the logic in all of the other ECxxxx IBoxes using this specific ECOM100 module. V402-V502 is a common 130-byte buffer available for use by the other ECxxxx IBoxes using this specific ECOM100 module.
NOTE: An ECOM100 IBox instruction is used without a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
Rung 2: On the second scan, assign the Gateway Address of the ECOM100 to 192.168.0.1
The ECWRGWA is leading edge triggered, not power-flow driven (similar to a counter input leg). The command to write the Gateway Address will be sent to the ECOM100 whenever the power flow into the IBox goes from OFF to ON.
If successful, turn on C100. If there is a failure, turn on C101. If it fails, you can look at V2000 for the specific error code.
To configure all of the ECOM100 TCP/IP parameters in one IBox, see the ECOM100 IP Setup (ECIPSUP) IBox.
ECOM100 ConfigECOM100 IB-710
ECOM100#SlotStatusWorkspaceMsg Buffer (65 WORDs)
K0K1
V400V401
V402-502
1
DL205 User Manual, 5th Edition, Rev. B5-312
Chapter 5: Standard RLL Instructions
ECOM100 Write IP Address (ECWRIP) (IB-723)ECOM100 Write IP Address will write the given IP Address to the ECOM100 module on a leading edge transition to the IBox. See also ECOM100 IP Setup (ECIPSUP) IBox 717 to setup ALL of the TCP/IP parameters in a single instruction - IP Address, Subnet Mask, and Gateway Address.
The Workspace parameter is an internal, private register used by this IBox and MUST BE UNIQUE in this one instruction and MUST NOT be used anywhere else in your program.
Either the Success or Error bit parameter will turn on once the command is complete. If there is an error, the Error Code parameter will report an ECOM100 error code (less than 100), or a PLC logic error (greater than 1000).
The IP Address is stored in Flash-ROM in the ECOM100 and the execution of this IBox will disable the ECOM100 module for at least a half second until it writes the Flash-ROM. Therefore, it is HIGHLY RECOMMENDED that you only execute this IBox ONCE on the second scan. Since it requires a LEADING edge to execute, use a NORMALLY CLOSED SP0 (STR NOT First Scan) to drive the power flow to the IBox.
In order for this ECOM100 IBox to function, you must turn ON dip switch 7 on the ECOM100 circuit board.
ECWRIP 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
• Workspace: specifies a V-memory location that will be used by the instruction
• Success: specifies a bit that will turn on once the request is completed successfully
• Error: specifies a bit that will turn on if the instruction is not successfully completed
• Error Code: specifies the location where the Error Code will be written• IP Address: specifies the IP Address that will be written to the module
DS5 Used
HPP N/A
Parameter DL205 RangeECOM100# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Workspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError Code ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsIP Address ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ 0.0.0.1. to 255.255.255.254
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-313
Chapter 5: Standard RLL Instructions
ECWRIP ExampleRung 1: The ECOM100 Config IBox is responsible for coordination/interlocking of all ECOM100 type IBoxes for one specific ECOM100 module. Tag the ECOM100 in slot 1 as ECOM100# K0. All other ECxxxx IBoxes refer to this module # as K0. If you need to move the module in the base to a different slot, then you only need to change this one IBox. V400 is used as a global result status register for the other ECxxxx IBoxes using this specific ECOM100 module. V401 is used to coordinate/interlock the logic in all of the other ECxxxx IBoxes using this specific ECOM100 module. V402-V502 is a common 130-byte buffer available for use by the other ECxxxx IBoxes using this specific ECOM100 module.
NOTE: An ECOM100 IBox instruction is used without a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
Rung 2: On the second scan, assign the IP Address of the ECOM100 to 192.168.12.100
The ECWRIP is leading edge triggered, not power-flow driven (similar to a counter input leg). The command to write the IP Address will be sent to the ECOM100 whenever the power flow into the IBox goes from OFF to ON.
If successful, turn on C100. If there is a failure, turn on C101. If it fails, you can look at V2000 for the specific error code.
To configure all of the ECOM100 TCP/IP parameters in one IBox, see the ECOM100 IP Setup (ECIPSUP) IBox.
ECOM100 ConfigECOM100 IB-710
ECOM100#SlotStatusWorkspaceMsg Buffer (65 WORDs)
K0K1
V400V401
V402-502
1
DL205 User Manual, 5th Edition, Rev. B5-314
Chapter 5: Standard RLL Instructions
ECOM100 Write Module ID (ECWRMID) (IB-721)ECOM100 Write Module ID will write the given Module ID on a leading edge transition to the IBox
If the Module ID is set in the hardware using the dipswitches, this IBox will fail and return error code 1005 (decimal).
The Workspace parameter is an internal, private register used by this IBox and MUST BE UNIQUE in this one instruction and MUST NOT be used anywhere else in your program.
Either the Success or Error bit parameter will turn on once the command is complete. If there is an error, the Error Code parameter will report an ECOM100 error code (less than 100), or a PLC logic error (greater than 1000).
The Module ID is stored in Flash-ROM in the ECOM100 and the execution of this IBox will disable the ECOM100 module for at least a half second until it writes the Flash-ROM. Therefore, it is HIGHLY RECOMMENDED that you only execute this IBox ONCE on the second scan. Since it requires a LEADING edge to execute, use a NORMALLY CLOSED SP0 (STR NOT First Scan) to drive the power flow to the IBox.
In order for this ECOM100 IBox to function, you must turn ON dip switch 7 on the ECOM100 circuit board.
ECWRMID 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
• Workspace: specifies a V-memory location that will be used by the instruction
• Success: specifies a bit that will turn on once the request is completed successfully
• Error: specifies a bit that will turn on if the instruction is not completed successfully
• Error Code: specifies the location where the Error Code will be written
• Module ID: specifies the Module ID that will be written to the module
DS5 Used
HPP N/A
Parameter DL205 RangeECOM100# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Workspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError Code ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsModule ID ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K0-65535
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-315
Chapter 5: Standard RLL Instructions
ECWRMID ExampleRung 1: The ECOM100 Config IBox is responsible for coordination/interlocking of all ECOM100 type IBoxes for one specific ECOM100 module. Tag the ECOM100 in slot 1 as ECOM100# K0. All other ECxxxx IBoxes refer to this module # as K0. If you need to move the module in the base to a different slot, then you only need to change this one IBox. V400 is used as a global result status register for the other ECxxxx IBoxes using this specific ECOM100 module. V401 is used to coordinate/interlock the logic in all of the other ECxxxx IBoxes using this specific ECOM100 module. V402-V502 is a common 130-byte buffer available for use by the other ECxxxx IBoxes using this specific ECOM100 module.
NOTE: An ECOM100 IBox instruction is used without a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
Rung 2: On the second scan, set the Module ID of the ECOM100. Typically this is done using NetEdit, but this IBox allows you to configure the module ID of the ECOM100 using your ladder program.
The ECWRMID is leading edge triggered, not power-flow driven (similar to a counter input leg). The command to write the module ID will be sent to the ECOM100 whenever the power flow into the IBox goes from OFF to ON.
If successful, turn on C100. If there is a failure, turn on C101. If it fails, you can look at V2000 for the specific error code.
ECOM100 ConfigECOM100 IB-710
ECOM100#SlotStatusWorkspaceMsg Buffer (65 WORDs)
K0K1
V400V401
V402-502
1
DL205 User Manual, 5th Edition, Rev. B5-316
Chapter 5: Standard RLL Instructions
ECOM100 Write Name (ECWRNAM) (IB-725)ECOM100 Write Name will write the given Name to the ECOM100 module on a leading edge transition to the IBox. If you use a dollar sign ($) or double quote (“), use the PRINT/VPRINT escape sequence of TWO dollar signs ($$) for a single dollar sign or dollar sign-double quote ($”) for a double quote character.
The Workspace parameter is an internal, private register used by this IBox and MUST BE UNIQUE in this one instruction and MUST NOT be used anywhere else in your program.
Either the Success or Error bit parameter will turn on once the command is complete. If there is an error, the Error Code parameter will report an ECOM100 error code (less than 100), or a PLC logic error (greater than 1000).
The Name is stored in Flash-ROM in the ECOM100 and the execution of this IBox will disable the ECOM100 module for at least a half second until it writes the Flash-ROM. Therefore, it is HIGHLY RECOMMENDED that you only execute this IBox ONCE on the second scan. Since it requires a LEADING edge to execute, use a NORMALLY CLOSED SP0 (STR NOT First Scan) to drive the power flow to the IBox.
In order for this ECOM100 IBox to function, you must turn ON dip switch 7 on the ECOM100 circuit board.
ECWRNAM 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.
• Workspace: specifies a V-memory location that will be used by the instruction.
• Success: specifies a bit that will turn on once the request is completed successfully.
• Error: specifies a bit that will turn on if the instruction is not completed successfully.
• Error Code: specifies the location where the Error Code will be written.• Module Name: specifies the Name that will be written to the module.
DS5 Used
HPP N/A
Parameter DL205 RangeECOM100# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Workspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError Code ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsModule Name ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ Text
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-317
Chapter 5: Standard RLL Instructions
ECWRNAM ExampleRung 1: The ECOM100 Config IBox is responsible for coordination/interlocking of all ECOM100 type IBoxes for one specific ECOM100 module. Tag the ECOM100 in slot 1 as ECOM100# K0. All other ECxxxx IBoxes refer to this module # as K0. If you need to move the module in the base to a different slot, then you only need to change this one IBox. V400 is used as a global result status register for the other ECxxxx IBoxes using this specific ECOM100 module. V401 is used to coordinate/interlock the logic in all of the other ECxxxx IBoxes using this specific ECOM100 module. V402-V502 is a common 130-byte buffer available for use by the other ECxxxx IBoxes using this specific ECOM100 module.
NOTE: An ECOM100 IBox instruction is used without a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
Rung 2: On the second scan, set the Module Name of the ECOM100. Typically this is done using NetEdit, but this IBox allows you to configure the module name of the ECOM100 using your ladder program.
The ECWRNAM is leading edge triggered, not power-flow driven (similar to a counter input leg). The command to write the module name will be sent to the ECOM100 whenever the power flow into the IBox goes from OFF to ON.
If successful, turn on C100. If there is a failure, turn on C101. If it fails, you can look at V2000 for the specific error code.
ECOM100 ConfigECOM100 IB-710
ECOM100#SlotStatusWorkspaceMsg Buffer (65 WORDs)
K0K1
V400V401
V402-502
1
DL205 User Manual, 5th Edition, Rev. B5-318
Chapter 5: Standard RLL Instructions
ECOM100 Write Subnet Mask (ECWRSNM) (IB-733)ECOM100 Write Subnet Mask will write the given Subnet Mask to the ECOM100 module on a leading edge transition to the IBox. See also ECOM100 IP Setup (ECIPSUP) IBox 717 to set up ALL of the TCP/IP parameters in a single instruction - IP Address, Subnet Mask, and Gateway Address.
The Workspace parameter is an internal, private register used by this IBox and MUST BE UNIQUE in this one instruction and MUST NOT be used anywhere else in your program.
Either the Success or Error bit parameter will turn on once the command is complete. If there is an error, the Error Code parameter will report an ECOM100 error code (less than 100), or a PLC logic error (greater than 1000).
The Subnet Mask is stored in Flash-ROM in the ECOM100 and the execution of this IBox will disable the ECOM100 module for at least a half second until it writes the Flash-ROM. Therefore, it is HIGHLY RECOMMENDED that you only execute this IBox ONCE on the second scan. Since it requires a LEADING edge to execute, use a NORMALLY CLOSED SP0 (STR NOT First Scan) to drive the power flow to the IBox.
In order for this ECOM100 IBox to function, you must turn ON dip switch 7 on the ECOM100 circuit board.
ECWRSNM 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.
• Workspace: specifies a V-memory location that will be used by the instruction.
• Success: specifies a bit that will turn on once the request is completed successfully.
• Error: specifies a bit that will turn on if the instruction is not completed successfully.
• Error Code: specifies the location where the Error Code will be written.
• Subnet Mask: specifies the Subnet Mask that will be written to the module.
DS5 Used
HPP N/A
Parameter DL205 RangeECOM100# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Workspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError Code ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSubnet Mask ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ Masked IP Address
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-319
Chapter 5: Standard RLL Instructions
ECWRSNM ExampleRung 1: The ECOM100 Config IBox is responsible for coordination/interlocking of all ECOM100 type IBoxes for one specific ECOM100 module. Tag the ECOM100 in slot 1 as ECOM100# K0. All other ECxxxx IBoxes refer to this module # as K0. If you need to move the module in the base to a different slot, then you only need to change this one IBox. V400 is used as a global result status register for the other ECxxxx IBoxes using this specific ECOM100 module. V401 is used to coordinate/interlock the logic in all of the other ECxxxx IBoxes using this specific ECOM100 module. V402-V502 is a common 130-byte buffer available for use by the other ECxxxx IBoxes using this specific ECOM100 module.
NOTE: An ECOM100 IBox instruction is used without a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
Rung 2: On the second scan, assign the Subnet Mask of the ECOM100 to 255.255.0.0
The ECWRSNM is leading edge triggered, not power-flow driven (similar to a counter input leg). The command to write the Subnet Mask will be sent to the ECOM100 whenever the power flow into the IBox goes from OFF to ON.
If successful, turn on C100. If there is a failure, turn on C101. If it fails, you can look at V2000 for the specific error code.
To configure all of the ECOM100 TCP/IP parameters in one IBox, see the ECOM100 IP Setup (ECIPSUP) IBox.
ECOM100 ConfigECOM100 IB-710
ECOM100#SlotStatusWorkspaceMsg Buffer (65 WORDs)
K0K1
V400V401
V402-502
1
DL205 User Manual, 5th Edition, Rev. B5-320
Chapter 5: Standard RLL Instructions
ECOM100 RX Network Read (ECRX) (IB-740)ECOM100 RX Network Read performs the RX instruction with built-in interlocking with all other ECOM100 RX (ECRX) and ECOM100 WX (ECWX) IBoxes in your program to simplify communications networking. It will perform the RX on the specified ECOM100#’s network, which corresponds to a specific unique ECOM100 Configuration (ECOM100) IBox at the top of your program.
The Workspace parameter is an internal, private register used by this IBox and MUST BE UNIQUE in this one instruction and MUST NOT be used anywhere else in your program.
Whenever this IBox has power, it will read element data from the specified slave into the given destination V-memory buffer, giving other ECOM100 RX and ECOM100 WX IBoxes on that ECOM100# network a chance to execute.
For example, if you wish to read and write data continuously from five different slaves, you can have all of these ECRX and ECWX instructions in ONE RUNG driven by SP1 (Always On). They will execute round-robin style, automatically!
ECRX 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
• Workspace: specifies a V-memory location that will be used by the instruction
• Slave ID: specifies the slave ECOM(100) PLC that will be targeted by the ECRX instruction
• From Slave Element (Src): specifies the slave address of the data to be read
• Number of Bytes: specifies the number of bytes to read from the slave ECOM(100) PLC
• To Master Element (Dest): specifies the location where the slave data will be placed in the master ECOM100 PLC
• Success: specifies a bit that will turn on once the request is completed successfully• Error: specifies a bit that will turn on if the instruction is not completed successfully
DS5 Used
HPP N/A
Parameter DL205 RangeECOM100# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Workspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSlave ID ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-90From Slave Element (Src) ⸠⸠⸠⸠⸠X,Y,C,S,T,CT,GX,GY,V See DL205 V-memory mapNumber of Bytes ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K1-128To Master Element (Dest) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory map
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-321
Chapter 5: Standard RLL Instructions
ECRX ExampleRung 1: The ECOM100 Config IBox is responsible for coordination/interlocking of all ECOM100 type IBoxes for one specific ECOM100 module. Tag the ECOM100 in slot 1 as ECOM100# K0. All other ECxxxx IBoxes refer to this module # as K0. If you need to move the module in the base to a different slot, then you only need to change this one IBox. V400 is used as a global result status register for the other ECxxxx IBoxes using this specific ECOM100 module. V401 is used to coordinate/interlock the logic in all of the other ECxxxx IBoxes using this specific ECOM100 module. V402-V502 is a common 130-byte buffer available for use by the other ECxxxx IBoxes using this specific ECOM100 module.
NOTE: An ECOM100 IBox instruction is used without a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
(Example continued on next page)
ECOM100 ConfigECOM100 IB-710
ECOM100#SlotStatusWorkspaceMsg Buffer (65 WORDs)
K0K1
V400V401
V402-502
1
DL205 User Manual, 5th Edition, Rev. B5-322
Chapter 5: Standard RLL Instructions
ECRX Example (cont’d)Rung 2: Using ECOM100# K0, read X0-X7 from Slave K7 and write them to slave K5 as fast as possible. Store them in this local PLC in C200-C207, and write them to C300-C307 in slave K5.
Both the ECRX and ECWX work with the ECOM100 Config IBox to simplify all networking by handling all of the interlocks and proper resource sharing. They also provide very simplified error reporting. You no longer need to worry about any SP “busy bits” or “error bits,” or what slot number a module is in, or have any counters or shift registers or any other interlocks for resource management.
In this example, SP1 (always ON) is driving both the ECRX and ECWX IBoxes in the same rung. On the scan that the Network Read completes, the Network Write will start that same scan. As soon as the Network Write completes, any pending operations below it in the program would get a turn. If there are no pending ECOM100 IBoxes below the ECWX, then the very next scan the ECRX would start its request again.
Using the ECRX and ECWX for all of your ECOM100 network reads and writes is the fastest the PLC can do networking. For local Serial Ports, DCM modules, or the original ECOM modules, use the NETCFG and NETRX/NETWX IBoxes.
DL205 User Manual, 5th Edition, Rev. B 5-323
Chapter 5: Standard RLL Instructions
ECOM100 WX Network Write(ECWX) (IB-741)ECOM100 WX Network Write performs the WX instruction with built-in interlocking with all other ECOM100 RX (ECRX) and ECOM100 WX (ECWX) IBoxes in your program to simplify communications networking. It will perform the WX on the specified ECOM100#’s network, which corresponds to a specific unique ECOM100 Configuration (ECOM100) IBox at the top of your program.
The Workspace parameter is an internal, private register used by this IBox and MUST BE UNIQUE in this one instruction and MUST NOT be used anywhere else in your program.
Whenever this IBox has power, it will write data from the master’s V-memory buffer to the specified slave starting with the given slave element, giving other ECOM100 RX and ECOM100 WX IBoxes on that ECOM100# network a chance to execute.
For example, if you wish to read and write data continuously from five different slaves, you can have all of these ECRX and ECWX instructions in ONE RUNG driven by SP1 (Always On). They will execute round-robin style, automatically!
ECWX 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.
• Workspace: specifies a V-memory location that will be used by the instruction.
• Slave ID: specifies the slave ECOM(100) PLC that will be targeted by the ECWX instruction.
• From Master Element (Src): specifies the location in the master ECOM100 PLC where the data will be sourced from.
• Number of Bytes: specifies the number of bytes to write to the slave ECOM(100) PLC.• To Slave Element (Dest): specifies the slave address the data will be written to.• Success: specifies a bit that will turn on once the request is completed successfully.• Error: specifies a bit that will turn on if the instruction is not completed successfully.
DS5 Used
HPP N/A
Parameter DL205 RangeECOM100# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Workspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSlave ID ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-90From Master Element (Src) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsNumber of Bytes ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K1-128To Slave Element (Dest) ⸠⸠⸠⸠⸠⸠⸠⸠X,Y,C,S,T,CT,GX,GY,V See DL205 V-memory mapSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory map
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-324
Chapter 5: Standard RLL Instructions
ECWX ExampleRung 1: The ECOM100 Config IBox is responsible for coordination/interlocking of all ECOM100 type IBoxes for one specific ECOM100 module. Tag the ECOM100 in slot 1 as ECOM100# K0. All other ECxxxx IBoxes refer to this module number as K0. If you need to move the module in the base to a different slot, then you only need to change this one IBox. V400 is used as a global result status register for the other ECxxxx IBoxes using this specific ECOM100 module. V401 is used to coordinate/interlock the logic in all of the other ECxxxx IBoxes using this specific ECOM100 module. V402-V502 is a common 130-byte buffer available for use by the other ECxxxx IBoxes using this specific ECOM100 module.
NOTE: An ECOM100 IBox instruction is used without a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
ECOM100 ConfigECOM100 IB-710
ECOM100#SlotStatusWorkspaceMsg Buffer (65 WORDs)
K0K1
V400V401
V402-502
1
DL205 User Manual, 5th Edition, Rev. B 5-325
Chapter 5: Standard RLL Instructions
ECWX Example (cont’d)Rung 2: Using ECOM100# K0, read X0-X7 from Slave K7 and write them to slave K5 as fast as possible. Store them in this local PLC in C200-C207, and write them to C300-C307 in slave K5.
Both the ECRX and ECWX work with the ECOM100 Config IBox to simplify all networking by handling all of the interlocks and proper resource sharing. They also provide very simplified error reporting. You no longer need to worry about any SP “busy bits” or “error bits,” or what slot number a module is in, or have any counters or shift registers or any other interlocks for resource management.
In this example, SP1 (always ON) is driving both the ECRX and ECWX IBoxes in the same rung. On the scan that the Network Read completes, the Network Write will start that same scan. As soon as the Network Write completes, any pending operations below it in the program would get a turn. If there are no pending ECOM100 IBoxes below the ECWX, then the very next scan the ECRX would start its request again.
Using the ECRX and ECWX for all of your ECOM100 network reads and writes is the fastest the PLC can do networking. For local Serial Ports, DCM modules, or the original ECOM modules, use the NETCFG and NETRX/NETWX IBoxes.
DL205 User Manual, 5th Edition, Rev. B5-326
Chapter 5: Standard RLL Instructions
NETCFG Network Configuration (NETCFG) (IB-700)Network Config defines all the common information necessary for performing RX/WX Networking using the NETRX and NETWX IBox instructions via a local CPU serial port, DCM or ECOM module.
You must have the Network Config instruction at the top of your ladder/stage program with any other configuration IBoxes.
If you use more than one local serial port, DCM or ECOM in your PLC for RX/WX Networking, you must have a different Network Config instruction and Network number for EACH RX/WX network in your system that utilizes any NETRX/NETWX IBox instructions.
The second parameter “CPU Port or Slot” is the same value as in the high byte of the first LD instruction if you were coding the RX or WX rung yourself. This value is CPU and port specific. Use KF1 for local CPU serial port 2. Use K3 if a DCM or ECOM is located in slot 3 of a local 205 base.
The Workspace parameter is an internal, private register used by the Network Config IBox and MUST BE UNIQUE in this one instruction and MUST NOT be used anywhere else in your program.
NETCFG Parameters• Network#: specifies a unique number for
each ECOM(100) or DCM network to use
• CPU Port or Slot: specifies the CPU port number or slot number of DCM/ECOM(100) used
• Workspace: specifies a V-memory location that will be used by the instruction
DS5 Used
HPP N/A
Parameter DL205 RangeNetwork# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255CPU Port or Slot ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-FFWorkspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data Words
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-327
Chapter 5: Standard RLL Instructions
NETCFG ExampleThe Network Configuration IBox coordinates all of the interaction with other Network IBoxes (NETRX/NETWX). You must have a Network Configuration IBox for each serial port network, DCM module network, or original ECOM module network in your system. Configuration IBoxes must be at the top of your program and must execute every scan.
This IBox defines Network# K0 to be for the local CPU serial port #2 (KF1). For local CPU serial ports or DCM/ECOM modules, use the same value you would use in the most significant byte of the first LD instruction in a normal RX/WX rung to reference the port or module. Any NETRX or NETWX IBoxes that need to reference this specific network would enter K0 for their Network# parameter.
The Workspace register is used to maintain state information about the port or module, along with proper sharing and interlocking with the other NETRX and NETWX IBoxes in the program. This V-memory register must not be used anywhere else in the entire program.
NOTE: The Network Configuration IBox instruction is used without a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
DL205 User Manual, 5th Edition, Rev. B5-328
Chapter 5: Standard RLL Instructions
Network RX Read (NETRX) (IB-701)Network RX Read performs the RX instruction with built-in interlocking with all other Network RX (NETRX) and Network WX (NETWX) IBoxes in your program to simplify communications networking. It will perform the RX on the specified Network number, which corresponds to a specific unique Network Configuration (NETCFG) at the top of your program.
The Workspace parameter is an internal, private register used by this IBox and MUST BE UNIQUE in this one instruction and MUST NOT be used anywhere else in your program.
Whenever this IBox has power, it will read element data from the specified slave into the given destination V-memory buffer, giving other Network RX and Network WX IBoxes on that Network number a chance to execute.
For example, if you wish to read and write data continuously from five different slaves, you can have all of these NETRX and NETWX instructions in ONE RUNG driven by SP1 (Always On). They will execute round-robin style, automatically!
NETRX Parameters• Network#: specifies the (CPU ports,
DCMs, ECOMs) Network # defined by the NETCFG instruction.
• Workspace: specifies a V-memory location that will be used by the instruction.
• Slave ID: specifies the slave PLC that will be targeted by the NETRX instruction.
• From Slave Element (Src): specifies the slave address of the data to be read.
• Number of Bytes: specifies the number of bytes to read from the slave device.
• To Master Element (Dest): specifies the location where the slave data will be placed in the master PLC.
• Success: specifies a bit that will turn on once the request is completed successfully.• Error: specifies a bit that will turn on if the instruction is not completed successfully.
DS5 Used
HPP N/A
Parameter DL205 RangeNetwork# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Workspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSlave ID ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠K,V K0-90From Slave Element (Src) ⸠⸠⸠⸠⸠X,Y,C,S,T,CT,GX,GY,V See DL205 V-memory mapNumber of Bytes ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K1-128To Master Element (Dest) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory map
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-329
Chapter 5: Standard RLL Instructions
NETRX ExampleRung 1: The Network Configuration IBox coordinates all of the interaction with other Network IBoxes (NETRX/NETWX). You must have a Network Configuration IBox for each serial port network, DCM module network, or original ECOM module network in your system. Configuration IBoxes must be at the top of your program and must execute every scan.
This IBox defines Network# K0 to be for the local CPU serial port #2 (KF1). For local CPU serial ports or DCM/ECOM modules, use the same value you would use in the most significant byte of the first LD instruction in a normal RX/WX rung to reference the port or module. Any NETRX or NETWX IBoxes that need to reference this specific network would enter K0 for their Network# parameter.
The Workspace register is used to maintain state information about the port or module, along with proper sharing and interlocking with the other NETRX and NETWX IBoxes in the program. This V-memory register must not be used anywhere else in the entire program.
NOTE: The Network Configuration IBox instruction is used without a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
(Example continued on next page)
DL205 User Manual, 5th Edition, Rev. B5-330
Chapter 5: Standard RLL Instructions
NETRX Example (cont’d)Rung 2: Using Network# K0, read X0-X7 from Slave K7 and write them to slave K5 as fast as possible. Store them in this local PLC in C200-C207, and write them to C300-C307 in slave K5.
Both the NETRX and NETWX work with the Network Config IBox to simplify all networking by handling all of the interlocks and proper resource sharing. They also provide very simplified error reporting. You no longer need to worry about any SP “busy bits” or “error bits,” or what port number or slot number a module is in, or have any counters or shift registers or any other interlocks for resource management.
In this example, SP1 (always ON) is driving both the NETRX and NETWX IBoxes in the same rung. On the scan that the Network Read completes, the Network Write will start that same scan. As soon as the Network Write completes, any pending operations below it in the program would get a turn. If there are no pending NETRX or NETWX IBoxes below this IBox, then the very next scan the NETRX would start its request again.
Using the NETRX and NETWX for all of your serial port, DCM, or original ECOM network reads and writes is the fastest the PLC can do networking. For ECOM100 modules, use the ECOM100 and ECRX/ECWX IBoxes.
DL205 User Manual, 5th Edition, Rev. B 5-331
Chapter 5: Standard RLL Instructions
Network WX Write (NETWX) (IB-702)Network WX Write performs the WX instruction with built-in interlocking with all other Network RX (NETRX) and Network WX (NETWX) IBoxes in your program to simplify communications networking. It will perform the WX on the specified Network number, which corresponds to a specific unique Network Configuration (NETCFG) at the top of your program.
The Workspace parameter is an internal, private register used by this IBox and MUST BE UNIQUE in this one instruction and MUST NOT be used anywhere else in your program.
Whenever this IBox has power, it will write data from the master’s V-memory buffer to the specified slave starting with the given slave element, giving other Network RX and Network WX IBoxes on that Network number a chance to execute.
For example, if you wish to read and write data continuously from five different slaves, you can have all of these NETRX and NETWX instructions in ONE RUNG driven by SP1 (Always On). They will execute round-robin style, automatically!
NETWX Parameters• Network#: specifies the (CPU ports,
DCMs, ECOMs) Network # defined by the NETCFG instruction
• Workspace: specifies a V-memory location that will be used by the instruction
• Slave ID: specifies the slave PLC that will be targeted by the NETWX instruction
• From Master Element (Src): specifies the location in the master PLC where the data will be sourced
• Number of Bytes: specifies the number of bytes to write to the slave PLC
• To Slave Element (Dest): specifies the slave address the data will be written to• Success: specifies a bit that will turn on once the request is completed successfully• Error: specifies a bit that will turn on if the instruction is not completed successfully
DS5 Used
HPP N/A
Parameter DL205 RangeNetwork# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Workspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSlave ID ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠K,V K0-90From Master Element (Src) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsNumber of Bytes ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K1-128To Slave Element (Dest) ⸠⸠⸠⸠⸠⸠⸠⸠X,Y,C,S,T,CT,GX,GY,V See DL205 V-memory mapSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory map
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-332
Chapter 5: Standard RLL Instructions
NETWX ExampleRung 1: The Network Configuration IBox coordinates all of the interaction with other Network IBoxes (NETRX/NETWX). You must have a Network Configuration IBox for each serial port network, DCM module network, or original ECOM module network in your system. Configuration IBoxes must be at the top of your program and must execute every scan.
This IBox defines Network# K0 to be for the local CPU serial port #2 (KF1). For local CPU serial ports or DCM/ECOM modules, use the same value you would use in the most significant byte of the first LD instruction in a normal RX/WX rung to reference the port or module. Any NETRX or NETWX IBoxes that need to reference this specific network would enter K0 for their Network# parameter.
The Workspace register is used to maintain state information about the port or module, along with proper sharing and interlocking with the other NETRX and NETWX IBoxes in the program. This V-memory register must not be used anywhere else in the entire program.
NOTE: The Network Configuration IBox instruction is used without a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
(Example continued on next page)
DL205 User Manual, 5th Edition, Rev. B 5-333
Chapter 5: Standard RLL Instructions
NETWX Example (cont’d)Rung 2: Using Network# K0, read X0-X7 from Slave K7 and write them to slave K5 as fast as possible. Store them in this local PLC in C200-C207, and write them to C300-C307 in slave K5.
Both the NETRX and NETWX work with the Network Config IBox to simplify all networking by handling all of the interlocks and proper resource sharing. They also provide very simplified error reporting. You no longer need to worry about any SP “busy bits” or “error bits”, or what port number or slot number a module is in, or have any counters or shift registers or any other interlocks for resource management.
In this example, SP1 (always ON) is driving both the NETRX and NETWX IBoxes in the same rung. On the scan that the Network Read completes, the Network Write will start that same scan. As soon as the Network Write completes, any pending operations below it in the program would get a turn. If there are no pending NETRX or NETWX IBoxes below this IBox, then the very next scan the NETRX would start its request again.
Using the NETRX and NETWX for all of your serial port, DCM, or original ECOM network reads and writes is the fastest the PLC can do networking. For ECOM100 modules, use the ECOM100 and ECRX/ECWX IBoxes.
DL205 User Manual, 5th Edition, Rev. B5-334
Chapter 5: Standard RLL Instructions
CTRIO Configuration (CTRIO) (IB-1000)CTRIO Config defines all the common information for one specific CTRIO module which is used by the other CTRIO IBox instructions (for example, CTRLDPR - CTRIO Load Profile, CTREDRL - CTRIO Edit and Reload Preset Table, CTRRTLM - CTRIO Run to Limit Mode, ...).
The Input/Output parameters for this instruction can be copied directly from the CTRIO Workbench configuration for this CTRIO module. Since the behavior is slightly different when the CTRIO module is in an EBC Base via an ERM, you must specify whether the CTRIO module is in a local base or in an EBC base.
You must have the CTRIO Config IBox at the top of your ladder/stage program along with any other configuration IBoxes. If you have more than one CTRIO in your PLC, you must have a different CTRIO Config IBox for EACH CTRIO module in your system that utilizes any CTRIO IBox instructions. Each CTRIO Config IBox must have a UNIQUE CTRIO# value. This is how the CTRIO IBoxes differentiate between the different CTRIO modules in your system.
The Workspace parameter is an internal, private register used by the CTRIO Config IBox and MUST BE UNIQUE in this one instruction and MUST NOT be used anywhere else in your program.
CTRIO Parameters• CTRIO#: specifies a specific CTRIO module based on a user defined number• Slot: (local base): specifies which PLC slot is occupied by the module (always K0 for EBC
base) • Workspace: specifies a V-memory location that will be used by the instruction• CTRIO Location: specifies where the module is located (PLC local base or ERM to EBC
base)• Input (local base): This needs to be set to the same V-memory register as is specified in
CTRIO Workbench as ‘Starting V address for inputs’ for this unique CTRIO.• Output (local base): This needs to be set to the same V-memory register as is specified in
CTRIO Workbench as ‘Starting V address for outputs’ for this unique CTRIO.• Word Input (EBC base): The starting input V-memory address as defined by the I/O
configuration in the ERM Workbench• Bit Input (EBC base): The starting input Bit address as defined by the I/O configuration
in the ERM Workbench• Word Output (EBC base): The starting output V-memory address as defined by the I/O
configuration in the ERM Workbench• Bit Output (EBC base): The starting output Bit address as defined by the I/O
configuration in the ERM Workbench.
DS5 Used
HPP N/A
CTRIO in Local Base CTRIO in EBC Base
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-335
Chapter 5: Standard RLL Instructions
CTRIO Example (local base)Rung 1: This sets up the CTRIO module in slot 2 of the local base. Each CTRIO module in the system will need a separate CTRIO Config IBox before any CTRxxxx IBoxes can be used. The CTRIO has been configured to use V2000 through V2025 for its input data, and V2030 through V2061 for its output data.
CTRIO Example (EBC base)Overview: ERM Workbench must first be used to assign memory addresses to the I/O modules in the EBC base. Once the CTRIO module memory addresses are established using ERM Workbench, they are used in CTRIO Workbench and in a CTRIO IBox instruction to configure and define a specific CTRIO module. For this example, the CTRIO module uses V2000 - V2017 for its Word Input data and B40416.0 - B40423.15 for its Bit Input data. The module uses V2100 - V2123 for its Word Output data and B40515.0 - B40522.15 for its Bit Output data. The starting addresses, V2000 and V40416 (for inputs) and V2100 and V40515 (for outputs) are entered into CTRIO Workbench I/O Map to configure this specific CTRIO module. These starting addresses are the memory locations used in the CTRIO IBox instruction as the Word Input, Bit Input, Word Output and Bit Output addresses as shown below. For more information on this topic, refer to the CTRIO User Manual “Program Control” chapter.
NOTE: The CTRIO Configuration IBox instructions do not require a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
Parameter DL205 RangeCTRIO# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Slot ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-7Workspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsInput (Word, Bit) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,B See DL205 V-memory map - Data WordsOutput (Word, Bit) ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,B See DL205 V-memory map - Data Words
DL205 User Manual, 5th Edition, Rev. B5-336
Chapter 5: Standard RLL Instructions
CTRIO Add Entry to End of Preset Table (CTRADPT) (IB-1005)CTRIO Add Entry to End of Preset Table, on a leading edge transition to this IBox, will append an entry to the end of a memory based Preset Table on a specific CTRIO Output resource. This IBox will take more than one PLC scan to execute. Either the Success or Error bit will turn on when the command is complete. If the Error Bit is on, you can use the CTRIO Read Error Code (CTRRDER) IBox to get extended error information.
Entry Type:
K0: Set
K1: Reset
K2: Pulse On (uses Pulse Time)
K3: Pulse Off (uses Pulse Time)
K4: Toggle
K5: Reset Count
Note that the Pulse Time parameter is ignored by some Entry Types.
The Workspace register is for internal use by this IBox instruction and MUST NOT be used anywhere else in your program.
CTRADPT Parameters• CTRIO#: specifies a specific CTRIO module
based on a user-defined number (see CTRIO Config)
• Output#: specifies a CTRIO output to be used by the instruction
• Entry Type: specifies the Entry Type to be added to the end of a Preset Table
• Pulse Time: specifies a pulse time in msecs for the Pulse On and Pulse Off Entry Types
• Preset Count: specifies an initial count value to begin at after Reset
• Workspace: specifies a V-memory location that will be used by the instruction
• Success: specifies a bit that will turn on once the instruction has completed successfully• Error: specifies a bit that will turn on if the instruction does not complete successfully
DS5 Used
HPP N/A
Parameter DL205 RangeCTRIO# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Output# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-3Entry Type ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,K K0-5; See DL205 V-memory map - Data WordsPulse Time ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,K K0-65535; See DL205 V-memory map - Data WordsPreset Count ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,K K0-2147434528; See DL205 V-memory mapWorkspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory map
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-337
Chapter 5: Standard RLL Instructions
CTRADPT ExampleRung 1: This sets up the CTRIO module in slot 2 of the local base. Each CTRIO module in the system will need a separate CTRIO Config IBox before any CTRxxxx IBoxes can be used. The CTRIO has been configured to use V2000 through V2025 for its input data, and V2030 through V2061 for its output data.
NOTE: The CTRIO Configuration IBox instruction does not require a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
Rung 2: This rung is a sample method for enabling the CTRADPT command. A C-bit is used to allow the programmer to control the command from Data View for testing purposes.
Turning on C0 will cause the CTRADPT instruction to add a new preset to the preset table for output #0 on the CTRIO in slot 2. The new preset will be a command to RESET (entry type K1=reset), pulse time is left at zero as the reset type does not use this, and the count at which it will reset will be 20.
Operating procedure for this example code is to load the CTRADPT_ex1.cwb file to your CTRIO, then enter the code shown here, change to RUN mode, enable output #0 by turning on C2 in Data View, turn encoder on CTRIO to value above 10 and output #0 light will come on and stay on for all counts past 10. Now reset the counter with C1, enable C0 to execute CTRADPT command to add a reset for output #0 at a count of 20, turn on C2 to enable output #0, then turn encoder to value of 10+ (output #0 should turn on) and then continue on to count of 20+ (output #0 should turn off).
(Example continued on next page)
DL205 User Manual, 5th Edition, Rev. B5-338
Chapter 5: Standard RLL Instructions
CTRADPT Example (cont’d)Rung 3: This rung allows the programmer to reset the counter from the ladder logic.
Rung 4: This rung allows the operator to enable output #0 from the ladder code.
DL205 User Manual, 5th Edition, Rev. B 5-339
Chapter 5: Standard RLL Instructions
CTRIO Clear Preset Table (CTRCLRT) (IB-1007)CTRIO Clear Preset Table will clear the RAM-based Preset Table on a leading edge transition to this IBox. This IBox will take more than one PLC scan to execute. Either the Success or Error bit will turn on when the command is complete. If the Error Bit is on, you can use the CTRIO Read Error Code (CTRRDER) IBox to get extended error information.
The Workspace register is for internal use by this IBox instruction and MUST NOT be used anywhere else in your program.
CTRCLRT Parameters• CTRIO#: specifies a specific CTRIO module
based on a user-defined number (see CTRIO Config)
• Output#: specifies a CTRIO output to be used by the instruction
• Workspace: specifies a V-memory location that will be used by the instruction
• Success: specifies a bit that will turn on once the instruction has completed successfully
• Error: specifies a bit that will turn on if the instruction does not complete successfully
DS5 Used
HPP N/A
Parameter DL205 RangeCTRIO# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Output# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-3Workspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory map
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-340
Chapter 5: Standard RLL Instructions
CTRCLRT ExampleRung 1: This sets up the CTRIO module in slot 2 of the local base. Each CTRIO module in the system will need a separate CTRIO Config IBox before any CTRxxxx IBoxes can be used. The CTRIO has been configured to use V2000 through V2025 for its input data, and V2030 through V2061 for its output data.
NOTE: The CTRIO Configuration IBox instruction does not require a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
Rung 2: This rung is a sample method for enabling the CTRCLRT command. A C-bit is used to allow the programmer to control the command from Data View for testing purposes.
Turning on C0 will cause the CTRCLRT instruction to clear the preset table for output #0 on the CTRIO in slot 2.
Operating procedure for this example code is to load the CTRCLRT_ex1.cwb file to your CTRIO, then enter the code shown here, change to RUN mode, enable output #0 by turning on C2 in Data View, turn encoder on CTRIO to value above 10 and output #0 light will come on and stay on until a count of 20 is reached, where it will turn off. Now reset the counter with C1, enable C0 to execute CTRCLRT command to clear the preset table, turn on C2 to enable output #0, then turn encoder to value of 10+ (output #0 should NOT turn on).
DL205 User Manual, 5th Edition, Rev. B 5-341
Chapter 5: Standard RLL Instructions
CTRCLRT Example (cont’d)Rung 3: This rung allows the programmer to reset the counter from the ladder logic.
Rung 4: This rung allows the operator to enable output #0 from the ladder code.
DL205 User Manual, 5th Edition, Rev. B5-342
Chapter 5: Standard RLL Instructions
CTRIO Edit Preset Table Entry (CTREDPT) (IB-1003)CTRIO Edit Preset Table Entry, on a leading edge transition to this IBox, will edit a single entry in a Preset Table on a specific CTRIO Output resource. This IBox is good if you are editing more than one entry in a file at a time. If you wish to do just one edit and then reload the table immediately, see the CTRIO Edit and Reload Preset Table Entry (CTREDRL) IBox.
This IBox will take more than one PLC scan to execute. Either the Success or Error bit will turn on when the command is complete. If the Error Bit is on, you can use the CTRIO Read Error Code (CTRRDER) IBox to get extended error information.
Entry Type:
K0: Set
K1: Reset
K2: Pulse On (uses Pulse Time)
K3: Pulse Off (uses Pulse Time)
K4: Toggle
K5: Reset Count
Note that the Pulse Time parameter is ignored by some Entry Types.
The Workspace register is for internal use by this IBox instruction and MUST NOT be used anywhere else in your program.
CTREDPT Parameters• CTRIO#: specifies a specific CTRIO module
based on a user defined number (see CTRIO Config Ibox)
• Output#: specifies a CTRIO output to be used by the instruction
• Table#: specifies the Table number of which an Entry is to be edited
• Entry#: specifies the Entry location in the Preset Table to be edited
• Entry Type: specifies the Entry Type to add during the edit
• Pulse Time: specifies a pulse time in msecs for the Pulse On and Pulse Off Entry Types
• Preset Count: specifies an initial count value to begin at after Reset
• Workspace: specifies a V-memory location that will be used by the instruction• Success: specifies a bit that will turn on once the instruction has successfully completed• Error: specifies a bit that will turn on if the instruction does not complete successfully
DS5 Used
HPP N/A
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-343
Chapter 5: Standard RLL Instructions
CTREDPT ExampleRung 1: This sets up the CTRIO module in slot 2 of the local base. Each CTRIO module in the system will need a separate CTRIO Config IBox before any CTRxxxx IBoxes can be used. The CTRIO has been configured to use V2000 through V2025 for its input data, and V2030 through V2061 for its output data.
NOTE: The CTRIO Configuration IBox instruction does not require a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
Parameter DL205 RangeCTRIO# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Output# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-3Table# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,K K0-255; See DL205 V-memory map - Data WordsEntry# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,K K0-255; See DL205 V-memory map - Data WordsEntry Type ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,K K0-5; See DL205 V-memory map - Data WordsPulse Time ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,K K0-65535; See DL205 V-memory map - Data WordsPreset Count ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,K K0-2147434528; See DL205 V-memory mapWorkspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory map
(Example continued on next page)
DL205 User Manual, 5th Edition, Rev. B5-344
Chapter 5: Standard RLL Instructions
CTREDPT Example (cont’d)Rung 2: This rung is a sample method for enabling the CTREDPT command. A C-bit is used to allow the programmer to control the command from Data View for testing purposes.
Turning on C0 will cause the CTREDPT instruction to change the second preset from a reset at a count of 20 to a reset at a count of 30 for output #0 on the CTRIO in slot 2.
Operating procedure for this example code is to load the CTREDPT_ex1.cwb file to your CTRIO, then enter the code shown here, change to RUN mode, enable output #0 by turning on C2 in Data View, turn encoder on CTRIO to value above 10 and output #0 light will come on and stay on until a count of 20 is reached, where it will turn off. Now reset the counter with C1, enable C0 to execute CTREDPT command to change the second preset, turn on C2 to enable output #0, then turn encoder to value of 10+ (output #0 should turn on) and then continue past a count of 30 (output #0 should turn off).
Note that we must also reload the profile after changing the preset(s); this is why the CTRLDPR command follows the CTREDPT command in this example.
DL205 User Manual, 5th Edition, Rev. B 5-345
Chapter 5: Standard RLL Instructions
CTREDPT Example (cont’d)Rung 3: This rung allows the programmer to reset the counter from the ladder logic.
Rung 4: This rung allows the operator to enable output #0 from the ladder code.
DL205 User Manual, 5th Edition, Rev. B5-346
Chapter 5: Standard RLL Instructions
CTRIO Edit Preset Table Entry and Reload (CTREDRL) (IB-1002)CTRIO Edit Preset Table Entry and Reload, on a leading edge transition to this IBox, will perform this dual operation to a CTRIO Output resource in one CTRIO command. This IBox will take more than one PLC scan to execute. Either the Success or Error bit will turn on when the command is complete. If the Error Bit is on, you can use the CTRIO Read Error Code (CTRRDER) IBox to get extended error information.
Entry Type:
K0: Set
K1: Reset
K2: Pulse On (uses Pulse Time)
K3: Pulse Off (uses Pulse Time)
K4: Toggle
K5: Reset Count
Note that the Pulse Time parameter is ignored by some Entry Types.
The Workspace register is for internal use by this IBox instruction and MUST NOT be used anywhere else in your program.
CTREDRL Parameters• CTRIO#: specifies a specific CTRIO module based
on a user defined number (see CTRIO Config Ibox)• Output#: specifies a CTRIO output to be used by
the instruction• Table#: specifies the Table number of which an
Entry is to be edited• Entry#: specifies the Entry location in the Preset
Table to be edited• Entry Type: specifies the Entry Type to add during
the edit• Pulse Time: specifies a pulse time in msecs for the
Pulse On and Pulse Off Entry Types• Preset Count: specifies an initial count value to
begin at after Reset• Workspace: specifies a V-memory location that will be used by the instruction• Success: specifies a bit that will turn on once the instruction has completed successfully• Error: specifies a bit that will turn on if the instruction does not complete successfully
DS5Used
HPP N/A
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-347
Chapter 5: Standard RLL Instructions
CTREDRL ExampleRung 1: This sets up the CTRIO module in slot 2 of the local base. Each CTRIO module in the system will need a separate CTRIO Config IBox before any CTRxxxx IBoxes can be used. The CTRIO has been configured to use V2000 through V2025 for its input data, and V2030 through V2061 for its output data.
NOTE: The CTRIO Configuration IBox instruction does not require a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
Parameter DL205 RangeCTRIO# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Output# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-3Table# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,K K0-255; See DL205 V-memory map - Data WordsEntry# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,K K0-255; See DL205 V-memory map - Data WordsEntry Type ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,K K0-5; See DL205 V-memory map - Data WordsPulse Time ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,K K0-65535; See DL205 V-memory map - Data WordsPreset Count ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,K K0-2147434528; See DL205 V-memory mapWorkspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory map
(Example continued on next page)
DL205 User Manual, 5th Edition, Rev. B5-348
Chapter 5: Standard RLL Instructions
CTREDRL Example (cont’d)Rung 2: This rung is a sample method for enabling the CTREDRL command. A C-bit is used to allow the programmer to control the command from Data View for testing purposes.
Turning on C0 will cause the CTREDRL instruction to change the second preset in file 1 from a reset value of 20 to a reset value of 30.
Operating procedure for this example code is to load the CTREDRL_ex1.cwb file to your CTRIO, then enter the code shown here, change to RUN mode, enable output #0 by turning on C2 in Data View, turn encoder on CTRIO to value above 10 and output #0 light will come on, continue to a count above 20 and the output #0 light will turn off. Now reset the counter with C1, enable C0 to execute CTREDRL command to change the second preset count value to 30, then turn encoder to value of 10+ (output #0 should turn on) and continue on to a value of 30+ and the output #0 light will turn off.
Note that it is not necessary to reload this file separately, however, the command can only change one value at a time.
(Example continued on next page)
DL205 User Manual, 5th Edition, Rev. B 5-349
Chapter 5: Standard RLL Instructions
CTREDRL Example (cont’d)Rung 3: This rung allows the programmer to reset the counter from the ladder logic.
Rung 4: This rung allows the operator to enable output #0 from the ladder code.
DL205 User Manual, 5th Edition, Rev. B5-350
Chapter 5: Standard RLL Instructions
CTRIO Initialize Preset Table (CTRINPT) (IB-1004)CTRIO Initialize Preset Table, on a leading edge transition to this IBox, will create a single entry Preset Table in memory but not as a file, on a specific CTRIO Output resource. This IBox will take more than one PLC scan to execute. Either the Success or Error bit will turn on when the command is complete. If the Error Bit is on, you can use the CTRIO Read Error Code (CTRRDER) IBox to get extended error information.
Entry Type:
K0: Set
K1: Reset
K2: Pulse On (uses Pulse Time)
K3: Pulse Off (uses Pulse Time)
K4: Toggle
K5: Reset Count
Note that the Pulse Time parameter is ignored by some Entry Types.
The Workspace register is for internal use by this IBox instruction and MUST NOT be used anywhere else in your program.
CTRINPT Parameters• CTRIO#: specifies a specific CTRIO module
based on a user defined number (see CTRIO Config Ibox)
• Output#: specifies a CTRIO output to be used by the instruction
• Entry Type: specifies the Entry Type to add during the edit
• Pulse Time: specifies a pulse time in msecs for the Pulse On and Pulse Off Entry Types
• Preset Count: specifies an initial count value to begin at after Reset
• Workspace: specifies a V-memory location that will be used by the instruction
• Success: specifies a bit that will turn on once the instruction has completed successfully• Error: specifies a bit that will turn on if the instruction does not complete successfully
DS5Used
HPP N/A
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-351
Chapter 5: Standard RLL Instructions
CTRINPT ExampleRung 1: This sets up the CTRIO module in slot 2 of the local base. Each CTRIO module in the system will need a separate CTRIO Config IBox before any CTRxxxx IBoxes can be used. The CTRIO has been configured to use V2000 through V2025 for its input data, and V2030 through V2061 for its output data.
NOTE: The CTRIO Configuration IBox instruction does not require a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
Parameter DL205 RangeCTRIO# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Output# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-3Entry Type ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,K K0-5; See DL205 V-memory map - Data WordsPulse Time ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,K K0-65535; See DL205 V-memory map - Data WordsPreset Count ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,K K0-2147434528; See DL205 V-memory mapWorkspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory map
(Example continued on next page)
DL205 User Manual, 5th Edition, Rev. B5-352
Chapter 5: Standard RLL Instructions
CTRINPT Example (cont’d)Rung 2: This rung is a sample method for enabling the CTRINPT command. A C-bit is used to allow the programmer to control the command from Data View for testing purposes.
Turning on C0 will cause the CTRINPT instruction to create a single entry preset table, but not as a file, and use it for the output #0. In this case the single preset will be set at a count of 15 for output #0.
Operating procedure for this example code is to load the CTRINPT_ex1.cwb file to your CTRIO, then enter the code shown here, change to RUN mode, enable output #0 by turning on C2 in Data View, turn encoder on CTRIO to value above 15 and output #0 light will not come on. Now reset the counter with C1, enable C0 to execute CTRINPT command to create a single preset table with a preset to set output#0 at a count of 15, then turn encoder to value of 15+ (output #0 should turn on).
DL205 User Manual, 5th Edition, Rev. B 5-353
Chapter 5: Standard RLL Instructions
CTRINPT Example (cont’d)Rung 3: This rung allows the programmer to reset the counter from the ladder logic.
Rung 4: This rung allows the operator to enable output #0 from the ladder code.
DL205 User Manual, 5th Edition, Rev. B5-354
Chapter 5: Standard RLL Instructions
CTRIO Initialize Preset Table on Reset (CTRINTR) (IB-1010)CTRIO Initialize Preset Table on Reset, on a leading edge transition to this IBox, will create a single entry Preset Table in memory but not as a file, on a specific CTRIO Output resource.This IBox will take more than 1 PLC scan to execute. Either the Success or Error bit will turn on when the command is complete. If the Error Bit is on, you can use the CTRIO Read Error Code (CTRRDER) IBox to get extended error information.
Entry Type:
K0: Set
K1: Reset
K2: Pulse On (uses Pulse Time)
K3: Pulse Off (uses Pulse Time)
K4: Toggle
K5: Reset Count
Note that the Pulse Time parameter is ignored by some Entry Types.
The Workspace register is for internal use by this IBox instruction and MUST NOT be used anywhere else in your program.
CTRINTR Parameters• CTRIO#: specifies a specific CTRIO module
based on a user defined number (see CTRIO Config Ibox)
• Output#: specifies a CTRIO output to be used by the instruction
• Entry Type: specifies the Entry Type to add during the edit
• Pulse Time: specifies a pulse time in msecs for the Pulse On and Pulse Off Entry Types
• Preset Count: specifies an initial count value to begin at after Reset
• Workspace: specifies a V-memory location that will be used by the instruction
• Success: specifies a bit that will turn on once the instruction has completed successfully• Error: specifies a bit that will turn on if the instruction does not complete successfully
DS5 Used
HPP N/A
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-355
Chapter 5: Standard RLL Instructions
CTRINTR ExampleRung 1: This sets up the CTRIO module in slot 2 of the local base. Each CTRIO module in the system will need a separate CTRIO Config IBox before any CTRxxxx IBoxes can be used. The CTRIO has been configured to use V2000 through V2025 for its input data, and V2030 through V2061 for its output data.
NOTE: The CTRIO Configuration IBox instruction does not require a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
Parameter DL205 RangeCTRIO# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Output# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-3Entry Type ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,K K0-5; See DL205 V-memory map - Data WordsPulse Time ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,K K0-65535; See DL205 V-memory map - Data WordsPreset Count ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,K K0-2147434528; See DL205 V-memory mapWorkspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory map
(Example continued on next page)
DL205 User Manual, 5th Edition, Rev. B5-356
Chapter 5: Standard RLL Instructions
CTRINTR Example (cont’d)Rung 2: This rung is a sample method for enabling the CTRINTR command. A C-bit is used to allow the programmer to control the command from Data View for testing purposes.
Turning on C0 will cause the CTRINTR instruction to create a single entry preset table, but not as a file, and use it for output #0, the new preset will be loaded when the current count is reset. In this case the single preset will be a set at a count of 25 for output #0.
Operating procedure for this example code is to load the CTRINTR_ex1.cwb file to your CTRIO, then enter the code shown here, change to RUN mode, enable output #0 by turning on C2 in Data View, turn encoder on CTRIO to value above 10 and output #0 light will come on. Now turn on C0 to execute the CTRINTR command, reset the counter with C1, then turn encoder to value of 25+ (output #0 should turn on).
DL205 User Manual, 5th Edition, Rev. B 5-357
Chapter 5: Standard RLL Instructions
CTRINTR Example (cont’d)Rung 3: This rung allows the programmer to reset the counter from the ladder logic.
Rung 4: This rung allows the operator to enable output #0 from the ladder code.
DL205 User Manual, 5th Edition, Rev. B5-358
Chapter 5: Standard RLL Instructions
CTRIO Load Profile (CTRLDPR) (IB-1001)CTRIO Load Profile loads a CTRIO Profile File to a CTRIO Output resource on a leading edge transition to this IBox. This IBox will take more than one PLC scan to execute. Either the Success or Error bit will turn on when the command is complete. If the Error Bit is on, you can use the CTRIO Read Error Code (CTRRDER) IBox to get extended error information.
The Workspace register is for internal use by this IBox instruction and MUST NOT be used anywhere else in your program.
CTRLDPR Parameters• CTRIO#: specifies a specific CTRIO
module based on a user defined number (see CTRIO Config)
• Output#: specifies a CTRIO output to be used by the instruction
• File#: specifies a CTRIO profile File number to be loaded
• Workspace: specifies a V-memory location that will be used by the instruction
• Success: specifies a bit that will turn on once the instruction has completed successfully
• Error: specifies a bit that will turn on if the instruction does not complete successfully
DS5 Used
HPP N/A
Parameter DL205 RangeCTRIO# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Output# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-3File# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,K K0-255; See DL205 V-memory map - Data WordsWorkspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory map
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-359
Chapter 5: Standard RLL Instructions
CTRLDPR ExampleRung 1: This sets up the CTRIO module in slot 2 of the local base. Each CTRIO module in the system will need a separate CTRIO Config IBox before any CTRxxxx IBoxes can be used. The CTRIO has been configured to use V2000 through V2025 for its input data, and V2030 through V2061 for its output data.
NOTE: The CTRIO Configuration IBox instruction does not require a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
Rung 2: This CTRIO Load Profile IBox will load File #1 into the working memory of Output 0 in CTRIO #1. This example program requires that you load CTRLDPR_IBox.cwb into your Hx-CTRIO(2) module.
(Example continued on next page)
DL205 User Manual, 5th Edition, Rev. B5-360
Chapter 5: Standard RLL Instructions
CTRLDPR Example (cont’d)Rung 3: If the file is loaded successfully, set Profile_Loaded.
DL205 User Manual, 5th Edition, Rev. B 5-361
Chapter 5: Standard RLL Instructions
CTRIO Read Error (CTRRDER) (IB-1014)CTRIO Read Error Code, on a leading edge transition to this IBox, will read the decimal error code value (listed below) from the CTRIO module and place it in the specified Error Code register. This instruction is not supported when the CTRIO is used in an ERM/EBC configuration.
Since the Error Code in the CTRIO is only maintained until another CTRIO command is given, you must use this instruction immediately after the CTRIO IBox that reports an error via its Error bit parameter.
The Workspace register is for internal use by this IBox instruction and MUST NOT be used anywhere else in your program.
Error Codes:
0: No Error
100: Specified command code is unknown or unsupported
101: File number not found in the file system
102: File type is incorrect for specified output function
103: Profile type is unknown
104: Specified input is not configured as a limit on this output
105: Specified limit input edge is out of range
106: Specified input function is unconfigured or invalid
107: Specified input function number is out of range
108: Specified preset function is invalid
109: Preset table is full
110: Specified Table entry is out of range
111: Specified register number is out of range
112: Specified register is an unconfigured input or output
2001: Error reading Error Code - cannot access CTRIO via ERM
CTRRDER Parameters• CTRIO#: specifies a specific CTRIO module based on a user-defined number (see
CTRIO Config)• Workspace: specifies a V-memory location that will be used by the instruction• Error Code: specifies the location where the Error Code will be written
DS5 Used
HPP N/A
Parameter DL205 RangeCTRIO# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Workspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsError Code ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data Words
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-362
Chapter 5: Standard RLL Instructions
CTRRDER ExampleRung 1: This sets up the CTRIO module in slot 2 of the local base. Each CTRIO module in the system will need a separate CTRIO Config IBox before any CTRxxxx IBoxes can be used. The CTRIO has been configured to use V2000 through V2025 for its input data, and V2030 through V2061 for its output data.
NOTE: The CTRIO Configuration IBox instruction does not require a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
Rung 2: This CTRIO Read Error Code IBox will read the Extended Error information from CTRIO #1. This example program requires that you load CTRRDER_IBox.cwb into your Hx-CTRIO(2) module.
DL205 User Manual, 5th Edition, Rev. B 5-363
Chapter 5: Standard RLL Instructions
CTRIO Run to Limit Mode (CTRRTLM) (IB-1011)CTRIO Run To Limit Mode, on a leading edge transition to this IBox, loads the Run to Limit command and given parameters on a specific Output resource. The CTRIO’s Input(s) must be configured as Limit(s) for this function to work.
Valid Hexadecimal Limit Values:
K00 - Rising Edge of Ch1/C
K10 - Falling Edge of Ch1/C
K20 - Both Edges of Ch1/C
K01 - Rising Edge of Ch1/D
K11 - Falling Edge of Ch1/D
K21 - Both Edges of Ch1/D
K02 - Rising Edge of Ch2/C
K12 - Falling Edge of Ch2/C
K22 - Both Edges of Ch2/C
K03 - Rising Edge of Ch2/D
K13 - Falling Edge of Ch2/D
K23 - Both Edges of Ch2/D
This IBox will take more than one PLC scan to execute. Either the Success or Error bit will turn on when the command is complete. If the Error Bit is on, you can use the CTRIO Read Error Code (CTRRDER) IBox to get extended error information.
The Workspace register is for internal use by this IBox instruction and MUST NOT be used anywhere else in your program.
CTRRTLM Parameters• CTRIO#: specifies a specific CTRIO module
based on a user-defined number (see CTRIO Config Ibox).
• Output#: specifies a CTRIO output to be used by the instruction.
• Frequency: specifies the output pulse rate (H2-CTRIO: 20Hz - 25KHz / H2-CTRIO2: 20Hz - 250 KHz).
• Limit: the CTRIO’s Input(s) must be configured as Limit(s) for this function to operate.
• Duty Cycle: specifies the % of on time versus off time. This is a hex number. Default of 0 is 50%, also entering 50 will yield 50%. 50% duty cycle is defined as on half the time and off half the time.
• Workspace: specifies a V-memory location that will be used by the instruction.• Success: specifies a bit that will turn on once the instruction has completed successfully.• Error: specifies a bit that will turn on if the instruction does not complete successfully.
DS5 Used
HPP N/A
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-364
Chapter 5: Standard RLL Instructions
CTRRTLM ExampleRung 1: This sets up the CTRIO module in slot 2 of the local base. Each CTRIO module in the system will need a separate CTRIO Config IBox before any CTRxxxx IBoxes can be used. The CTRIO has been configured to use V2000 through V2025 for its input data, and V2030 through V2061 for its output data.
NOTE: The CTRIO Configuration IBox instruction does not require a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
Rung 2: This CTRIO Run To Limit Mode IBox sets up Output #2 in CTRIO #1 to output pulses at a Frequency of 1000 Hz until Limit #0 comes on. This example program requires that you load CTRRTLM_IBox.cwb into your Hx-CTRIO(2) module.
Parameter DL205 RangeCTRIO# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Output# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-3Frequency ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,K K20-20000; See DL205 V-memory map - Data WordsLimit ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,K K0-FF; See DL205 V-memory map - Data WordsDuty Cycle ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,K K0-99; See DL205 V-memory map - Data WordsWorkspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory map
DL205 User Manual, 5th Edition, Rev. B 5-365
Chapter 5: Standard RLL Instructions
CTRRTLM Example (cont’d)Rung 3: If the Run To Limit Mode parameters are OK, set the Direction Bit and Enable the output.
DL205 User Manual, 5th Edition, Rev. B5-366
Chapter 5: Standard RLL Instructions
CTRIO Run to Position Mode (CTRRTPM) (IB-1012)CTRIO Run To Position Mode, on a leading edge transition to this IBox, loads the Run to Position command and given parameters on a specific Output resource.
Valid Function Values are:
00: Less Than Ch1/Fn1
10: Greater Than Ch1/Fn1
01: Less Than Ch1/Fn2
11: Greater Than Ch1/Fn2
02: Less Than Ch2/Fn1
12: Greater Than Ch2/Fn1
03: Less Than Ch2/Fn2
13: Greater Than Ch2/Fn2
This IBox will take more than one PLC scan to execute. Either the Success or Error bit will turn on when the command is complete. If the Error Bit is on, you can use the CTRIO Read Error Code (CTRRDER) IBox to get extended error information.
The Workspace register is for internal use by this IBox instruction and MUST NOT be used anywhere else in your program.
CTRRTPM Parameters• CTRIO#: specifies a specific CTRIO module based
on a user-defined number (see CTRIO Config Ibox).
• Output#: specifies a CTRIO output to be used by the instruction.
• Frequency: specifies the output pulse rate (H2-CTRIO: 20Hz - 25KHz / H2-CTRIO2: 20Hz - 250 KHz).
• Duty Cycle: specifies the % of on time versus off time. This is a hex number. Default of 0 is 50%, also entering 50 will yield 50%. 50% duty cycle is defined as on half the time and off half the time.
• Position: specifies the count value, as measured on the encoder input, at which the output pulse train will be turned off.
• Workspace: specifies a V-memory location that will be used by the instruction.• Success: specifies a bit that will turn on once the instruction has completed successfully.• Error: specifies a bit that will turn on if the instruction does not complete successfully.
DS5 Used
HPP N/A
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-367
Chapter 5: Standard RLL Instructions
CTRRTPM ExampleRung 1: This sets up the CTRIO module in slot 2 of the local base. Each CTRIO module in the system will need a separate CTRIO Config IBox before any CTRxxxx IBoxes can be used. The CTRIO has been configured to use V2000 through V2025 for its input data, and V2030 through V2061 for its output data.
NOTE: The CTRIO Configuration IBox instruction does not require a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
Parameter DL205 RangeCTRIO# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Output# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-3Frequency ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,K K20-20000; See DL205 V-memory map - Data WordsDuty Cycle ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,K K0-99; See DL205 V-memory mapPosition ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,K K0-2147434528; See DL205 V-memory mapWorkspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory map
DL205 User Manual, 5th Edition, Rev. B5-368
Chapter 5: Standard RLL Instructions
CTRRTPM Example (cont’d)Rung 2: This CTRIO Run To Position Mode IBox sets up Output #0 in CTRIO #1 to output pulses at a Frequency of 1000 Hz, use the ‘Greater than Ch1/Fn1’ comparison operator, until the input position of 1500 is reached. This example program requires that you load CTRRTPM_IBox.cwb into your Hx-CTRIO(2) module.
Rung 3: If the Run To Position Mode parameters are OK, set the Direction Bit and Enable the output.
DL205 User Manual, 5th Edition, Rev. B 5-369
Chapter 5: Standard RLL Instructions
CTRIO Velocity Mode (CTRVELO) (IB-1013)CTRIO Velocity Mode loads the Velocity command and given parameters on a specific Output resource on a leading edge transition to this IBox.
This IBox will take more than one PLC scan to execute. Either the Success or Error bit will turn on when the command is complete. If the Error Bit is on, you can use the CTRIO Read Error Code (CTRRDER) IBox to get extended error information.
The Workspace register is for internal use by this IBox instruction and MUST NOT be used anywhere else in your program.
CTRVELO Parameters• CTRIO#: specifies a specific CTRIO module based
on a user defined number (see CTRIO Config Ibox)
• Output#: specifies a CTRIO output to be used by the instruction
• Frequency: specifies the output pulse rate (H2-CTRIO: 20Hz - 25KHz / H2-CTRIO2: 20Hz - 250 KHz)
• Duty Cycle: specifies the % of on time versus off time. This is a hex number. Default of 0 is 50%, also entering 50 will yield 50%. 50% duty cycle is defined as on half the time and off half the time
• Step Count: This DWORD value specifies the number of pulses to output. A Step Count value of -1 (or 0xFFFFFFFF) causes the CTRIO to output pulses continuously. Negative Step Count values must be V-Memory references.
• Workspace: specifies a V-memory location that will be used by the instruction• Success: specifies a bit that will turn on once the instruction has successfully completed• Error: specifies a bit that will turn on if the instruction does not complete successfully
DS5 Used
HPP N/A
Parameter DL205 RangeCTRIO# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Output# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-3Frequency ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,K K20-20000; See DL205 V-memory map - Data WordsDuty Cycle ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,K K0-99; See DL205 V-memory mapStep Count ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠V,K K0-2147434528; See DL205 V-memory mapWorkspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory map
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B5-370
Chapter 5: Standard RLL Instructions
CTRVELO ExampleRung 1: This sets up the CTRIO module in slot 2 of the local base. Each CTRIO module in the system will need a separate CTRIO Config IBox before any CTRxxxx IBoxes can be used. The CTRIO has been configured to use V2000 through V2025 for its input data, and V2030 through V2061 for its output data.
NOTE: The CTRIO Configuration IBox instruction does not require a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
Rung 2: This CTRIO Velocity Mode IBox sets up Output #0 in CTRIO #1 to output 10,000 pulses at a Frequency of 1000 Hz. This example program requires that you load CTRVELO_IBox.cwb into your Hx-CTRIO(2) module.
DL205 User Manual, 5th Edition, Rev. B 5-371
Chapter 5: Standard RLL Instructions
CTRVELO Example (cont’d)Rung 3: If the Velocity Mode parameters are OK, set the Direction Bit and Enable the output.
DL205 User Manual, 5th Edition, Rev. B5-372
Chapter 5: Standard RLL Instructions
CTRIO Write File to ROM (CTRWFTR) (IB-1006)CTRIO Write File to ROM writes the runtime changes made to a loaded CTRIO Preset Table back to Flash ROM on a leading edge transition to this IBox. This IBox will take more than one PLC scan to execute. Either the Success or Error bit will turn on when the command is complete. If the Error Bit is on, you can use the CTRIO Read Error Code (CTRRDER) IBox to get extended error information.
The Workspace register is for internal use by this IBox instruction and MUST NOT be used anywhere else in your program.
CTRWFTR Parameters• CTRIO#: specifies a specific CTRIO module
based on a user defined number (see CTRIO Config Ibox)
• Output#: specifies a CTRIO output to be used by the instruction
• Workspace: specifies a V-memory location that will be used by the instruction
• Success: specifies a bit that will turn on once the instruction has completed successfully
• Error: specifies a bit that will turn on if the instruction does not complete successfully
DS5 Used
HPP N/A
Parameter DL205 RangeCTRIO# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-255Output# ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ K K0-3Workspace ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ V See DL205 V-memory map - Data WordsSuccess ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory mapError ⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠⸠ X,Y,C,GX,GY,B See DL205 V-memory map
230
240
250-1
260
262
�����
DL205 User Manual, 5th Edition, Rev. B 5-373
Chapter 5: Standard RLL Instructions
CTRWFTR ExampleRung 1: This sets up the CTRIO module in slot 2 of the local base. Each CTRIO module in the system will need a separate CTRIO Config IBox before any CTRxxxx IBoxes can be used. The CTRIO has been configured to use V2000 through V2025 for its input data, and V2030 through V2061 for its output data.
NOTE: The CTRIO Configuration IBox instruction does not require a permissive contact. The top line will be identified in BOLD italics, and the instruction name and ID will be in BOLD characters.
Rung 2: This CTRIO Edit Preset Table Entry IBox will change Entry 0 in Table #2 to be a RESET at Count 3456. This example program requires that you load CTRWFTR_IBox.cwb into your Hx-CTRIO(2) module.
(Example continued on next page)
DL205 User Manual, 5th Edition, Rev. B5-374
Chapter 5: Standard RLL Instructions
CTRWFTR Example (cont’d)Rung 3: If the file is successfully edited, use a Write File To ROM IBox to save the edited table back to the CTRIO’s ROM, thereby making the changes retentive.
Top Related