Topic: DMD0296 DLRX - DirectLOGIC Network Read |
||||||||||||||||||||||
|
||||||||||||||||||||||
The DirectLOGIC Network Read (DLRX) instruction uses the on board Ethernet port or an ECOM / ECOM100 module to read data from a DirectLOGIC PLC through an ECOM / ECOM100 module in the remote system. This instruction uses DirectNET protocol.
This instruction will be using an Ethernet port, which is a shared resource. The port's ability to concurrently handle multiple DLRX, DLWX, MRX, MWX, and EMAIL instructions is provided through a device driver. The device driver allows the port to process these concurrent requests without the traditional need for interlocking logic in the ladder program. For example, DirectLOGIC PLCs use the 'Port Busy' SP relay in the ladder program to interlock all of the RX and WX communication requests that are processed by the same communication port. That interlocking logic is NOT required with this instruction because the device driver that manages the port provides all of the port-sharing code internally.
|
||||||||||||||||||||||
|
||||||||||||||||||||||
Parameters:Note: Use the F9 key or click the 'three dot box' at the right edge of the parameter field to open the Default Element Selection Tool (the Element Picker or the Element Browser) or use the Down-Arrow key (Auto-Complete) on any parameter field to see a complete list of the memory locations that are valid for that parameter of the instruction.
Network Device selects which of the configured Ethernet Devices to use. Click the gear symbol at the right end of the device to open the configuration dialog for the selected device. For more information
on configuring devices go to the Device Configuration section of the System Configuration.
Remote Address specifies which of the following addressing modes to use:
From DL - designates the data type and the address of the data to read from the DirectLOGIC CPU. V-Memory locations in a DirectLOGIC CPU are unsigned 16-bit values
. The memory address value must begin on a Byte boundary.
Single Bit locations in the DirectLOGIC
CPUs cannot be read individually, you must read the Byte that contains
the desired Bit. For example, the Byte beginning at X0 contains the Bits X0 through
X7, the Byte beginning at X10 contains the Bits X10 through X17. To access
X12, read the Byte which begins at X10, then extract the 3rd Bit from
that Byte.
Number of Bytes - designates the number of elements of the selected type to read.
Note: if the Network Device is an ECOM100 that is being used as a Modbus TCP Client (Master) see Note #1 below.
To is the beginning memory address in the Do-more CPU to store the result from the Read operation. This value can be any writable numeric location.
Note: the DirectNET protocol does not support Bit level reads, it can only read Bytes (8 Bits) of data. This is not an issue when storing V-Memory values read from the remote slave - the only thing to remember is that each V-Memory location is 2-Bytes long. To store Bits read from one of the Bit ranges in the remote slave, this field must still be a Byte, Word or DWord location, or evaluate to a numeric location through a Cast operation. For example, to read 1 Byte (8 Bits) from a DirectLOGIC slave and store that Byte of data in the Do-more CPU starting at C16, enter the value "C16:UB", which is C16 cast to an Unsigned Byte. The Byte of data (8 Bits) will be placed in C16 - C23. And remember, the cast operations must be on Byte boundaries, for example: C0:UB is a valid cast, but C3:UB is not a valid cast.
Note: in most cases, the built-in DirectLOGIC memory blocks DLX / DLY / DLC / DLV should NOT be used as the location to store data received by the DLRX instruction because these ranges of memory locations are reserved for use by the Do-more's DirectLOGIC Server (Slave) function. Refer to the DirectLOGIC Memory Blocksdiagram in the Memory Configuration section of the System Configuration for more information.
Enable selects how this instruction will operate. Select from one of the following:
The On Success and On Error parameters specify what action to perform when this instruction completes. You do not have to use the same type of selection for both On Success and On Error.
If the Set Bit selection is used for either On Success or On Error, the specified BIT location will be SET OFF when the instruction is first enabled and will remain OFF until the instruction completes. Once complete, the appropriate Success or Error bit location ON. The specified Bit location is enabled with a SET (Latch) operation meaning that it will remain ON even if the input logic for the instruction goes OFF.
If the JMP to Stage selection is used for either On Success or On Error the target Stage must be in the same Program code-block as this instruction, you cannot specify a target Stage that exists in a different Program code-block. When the operation finishes, the target Stage will be enabled the same way as a standalone Jump to Stage (JMP) instruction would do it. The JMP to Stage option will only be available if this instruction is placed in a Program code-block.
On Success selects which of the following actions to perform if the operation is successful:
On Error selects which of
the following actions to perform if the operation is unsuccessful:
If either the On Success or On Error selections are set to JMP to Stage, Automatically create the SG box for any NEW stage number will be enabled which will automatically create any target stage that does not already exist.
|
||||||||||||||||||||||
|
||||||||||||||||||||||
Status Display:
The red triangle in the upper left corner of the status display indicates this is a Fully Asynchronous instruction.
|
||||||||||||||||||||||
|
||||||||||||||||||||||
See Also:DLRX - DirectLOGIC Network Read (Do-more PLC <- DirectLOGIC PLC)
DLWX - DirectLOGIC Network Write (Do-more PLC -> DirectLOGIC PLC)
EIPMSG - Send EtherNet/IP Message
PEERLINK - Share Data w / PLCs
RX - Do-more Network Read (Do-more PLC <- Do-more PLC)
WX - Do-more Network Write (Do-more PLC -> Do-more PLC)
|
||||||||||||||||||||||
|
||||||||||||||||||||||
Note #1:If the Network Device is an ECOM100 that has been configured as a Modbus TCP Client (Master) it is possible to utilize the DLRX's Number of Bytes parameter to differentiate between a Modbus function code 3 (FC03 - Read Holding Registers) and a Modbus function code 4 (FC04 - Read Input Registers) as shown in the following examples:
Read 4 Holding Registers (FC03) From DL : V0 (this would point to the first register) Number of Bytes : 8
Since the Number of Bytes is an even number (8), Holding Registers (40000+) are being targeted.
Read 4 Input Registers (FC04) From DL : V0 (this would point to the first register) Number of Bytes : 9
Since the Number of Bytes is an odd number (9), Input Registers (30000+) are being targeted.
The caveat to this is that in the case of reading Input Registers (FC04) and using the odd number, then the DLRX will actually write 9 bytes to the location specified in the DLRX's To parameter.
The
versions of ECOM100 firmware that have this feature are:
|
||||||||||||||||||||||
|
||||||||||||||||||||||
Example 1 of 2:Description of a Typical DirectLOGIC Network Read (DLRX) Stage Diagram:This is a stage diagram showing a typical sequence that monitors a DL-PLC slave (via an ECOM100) slave and reads up a new recipe whenever it becomes available.
Initially the NewRec (New Recipe) stage monitors a bit from the slave. When this bit comes ON, RecipeRdy (Recipe Ready) causes the transition to the RDRec stage.
The RDRec (Read Recipe) reads the new recipe from the slave. When this completes, RecipeRD (Recipe Read) causes the transition to the RSTRec stage.
The RSTRec (Reset Recipe) writes a bit to the slave to inform it the recipe has been read successfully. When this write is complete, RecipeRST (Recipe Reset) causes a transition to the RSTMon stage.
The RSTMon (Reset Monitor) stage monitors a bit from the slave to confirm the slave heard the reset. When this bit comes ON, MonRST (Monitor Reset) causes a transition back to the NewRec stage to repeat the process and wait for the next new recipe.
Description of a Typical DirectLOGIC Network Read (DLRX) Stage Ladder:This is a ladder program that is equivalent to the above stage diagram. It utilizes both the DirectLOGIC Network Read (DLRX) and DirectLOGIC Network Write (DLWX) instructions to monitor a DL-PLC slave (via the built-in Do-more Ethernet port to the DL-PLC's ECOM100) and read up a new recipe whenever it becomes available.
A summary of the master/slave interaction is as follows:
NewRecipe is the initial stage. The DLRX instruction is set to execute "Continuous at Interval 0.100s" to read a bank of C-bits (C10-27) from the DL-PLC. This word contains the bit the DL-PLC will turn ON when a new recipe has been stored and is ready for the Do-more PLC to read it up. C10 will be stored in Monitor's first bit (Monitor:0), C11 in Monitor's second bit (Monitor:1), etc, until 16 bit are stored. The DLRX reads this bank of bits and stores it in the Monitor word. Upon the successful completion of each read the ReadSuccess1 bit will come ON. When there has been a successful read and the Monitor:0 bit is ON, Rung 3 resets the Monitor:0 bit back OFF (in preparation for the next cycle) and transitions to the ReadRecipe stage. If any one of these reads fails, the DLRX instruction will transition to the ErrorStage where the error can be handled.
The ReadRecipe stage executes the DLRX instruction once to read up the new recipe from DL-PLC's V2000-2017 memory range and stores them in Do-more memory range RecipeVar01-RecipeVar16. Upon a successful read, the DLRX transitions to the ResetRecipe stage. If the read failed, the DLRX instruction will transition to the ErrorStage.
The ResetRecipe stage executes the DLWX instruction once to write the Monitor word (16 bits) down to the bank of C-bits (C10-27) to inform the DL-PLC the new recipe has been read up successfully (i.e. C10 will be written OFF). Upon a successful read, the DLWX transitions to the ResetMonitor stage. If the write failed, the DLWX instruction will transition to the ErrorStage.
The ResetMonitor stage monitors a feedback bit (C11) from the DL-PLC that the DL-PLC should use to inform the Do-more PLC that it "heard" the recipe read was successful and that the DL-PLC can now make preparations for the next recipe. The DLRX reads this bit (C11) by reading the same bank of bits (C10-27) and storing them in Monitor word. Upon the successful completion of each read the ReadSuccess2 bit will come ON. When there has been a successful read and the Monitor:1 bit (i.e. C11) is ON, Rung 10 resets the ReadSuccess2 bit back OFF (in preparation for the next cycle) and transitions back to the initial NextRecipe stage. If any one of these reads fails, the DLRX instruction will transition to the ErrorStage.
The ErrorStage should have code in it (not shown here) that evaluates the various errors that can occur in this example. Example 2 of 2:
|
||||||||||||||||||||||
|