Topic: DMD0296

Help File Version: 2.10.0.636

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.

create module indicates that there are no ECOM / ECOM100 modules that have been configured to perform this instruction, selecting this option will invoke the Module Configuration selection of the System Configuration where a suitable ECOM / ECOM100 module configuration can be created.


Remote Address specifies which of the following addressing modes to use:

 

  • Fixed IP Address specifies the IP Address assigned to the remote slave ECOM module. IP addresses are canonically represented in dot-decimal notation, consisting of four decimal numbers, each ranging from 0 to 255, separated by dots. This can be any valid IP Address on the same local network as the Do-more CPU or the ECOM module.

     

  • Variable IP Address the IP Address resides in a memory location in the PLC. This allows the IP Address to be changed at runtime. This can be any readable DWord numeric location. Each octet of the IP Address is stored in one byte of the Variable Address location. In the example below the Initialize Data instruction will use the :UB operator to place the 4 octet values of IP Address 192.168.26.71 into the 4 Bytes of the DWord location D0 in the proper order.

     


    Note: the 'IP Address' format selection in a Data View can be used to see the IP Address stored in the DWord location in the traditional dot-decimal notation (000.000.000.000).

 


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.

Memory Type

Range (octal)

V

0 to 41237

X

0 to 1770

Y

0 to 1770

C

0 to 3770

S

0 to 1770

T

0 to 370

CT

0 to 370

GX

0 to 3770

GY

0 to 3770

SP

0 to 770

 

Number of Bytes - designates the number of elements of the selected type to read.

 

  • V : each V-Memory location is 2 bytes in length, so reading V-Memory requires the length be in 2-Byte increments

     

  • X, Y, C, S, T, CT, GX, GY, SP : Bit locations are contained within Bytes of memory, the length must be in 1-Byte increments.

 

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:

 

 

    • Constant means the interval time is a fixed value specified as Hours / Minutes / Seconds / Milliseconds. 

       

    • Variable means this can be any writable numeric location that contains a value between 0 and 2,147,483,647.

 


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:

  • Enable SET Bit then specify any writable bit location.
  • Enable JMP to Stage then specify any Stage number from S0 to S127 in the current Program code-block.

 

On Error selects which of the following actions to perform if the operation is unsuccessful:
 

  • Enable SET Bit then specify writable bit location.
  • Enable JMP to Stage then specify any Stage number from S0 to S127 in the current Program code-block.

 

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.

  • Below this rung will create the new target stage on a new rung following this instruction.
  • At end of code-block will create the new target stage as the last rung of this Program.

 


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

 

MRX - Modbus Network Read

 

MWX - Modbus Network Write


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:
H0-ECOM100 v4.0.52 (or later)
H2-ECOM100 v4.0.999 (or later)
H4-ECOM100 v4.0.1031 (or later)

 


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:

  1. The Do-more monitors C10 bit from DL-PLC.

  2. The DL-PLC formulates a new recipe and stores it in V2000-2017 memory range.

  3. The DL-PLC sets C10 ON when the recipe is ready and begins to monitor for C10 to go back OFF in order to know when the Do-more has read the new recipe up.

  4. The Do-more sees C10 turn ON and reads up the new recipe from V2000-2017 memory range and stores it in his memory range RecipeVar01-RecipeVar16.

  5. The Do-more then turns the DL-PLC's C10 bit OFF to inform the DL-PLC he has read up the new recipe. Then the Do-more begins to monitor for C11 bit to come ON in order to know the DL-PLC heard him.

  6. The DL-PLC sees his C10 bit turn OFF and then turns ON his C11 bit to inform the Do-more he is now formulating the next recipe.

  7. The Do-more sees C11 come ON and can now repeat the cycle (return to step 1 above).

 

 

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: