Topic: P141

Network Write (WX) Instruction

Mnemonic (Keyboard Shortcut) = WX

Icon / Button =

Purpose

Perform Write requests to other P Series-CPUs by Writing the Tags of specified CPUs over the Ethernet, RS232 or RS485 Ports on the CPU.

Instruction Parameters

Parameter

Parameter Type

Requirements

Description

Enable

Ladder Input

Must Have

Edge-driven. If Automatic Polling is selected, the instruction becomes Level-driven. When Enable is ON, the instruction will operate every scan. When Enable is OFF, the instruction is not solved, and its outputs are not updated.

Ethernet Port

Selectable Option with Drop-down Selection

Must Select Ethernet Port or Serial Port

CPU External Ethernet Port that will send Read requests.

IP Address

Constant

Must Have when Ethernet Port Selected

IP Address of the CPU where the Write Request will be sent to.  Enabled when Ethernet Port is selected.

TCP Port Number

Constant

Must Have when Ethernet Port Selected

Default is 502 (number specified by Modbus TCP specification).  Some devices will require a different value.  Enabled when Ethernet Port is selected.

Serial Port

Selectable Option with Drop-down Selection

Must Select Ethernet Port or Serial Port

RS232 or RS485 CPU Port that will Send Write Requests.

Slave Node Number

Constant

Must Have when Serial Port Selected

Enter the Node Addressof theCPU to which toWrite.  TheSlave Node is found in the Hardware Configuration for the Port on that CPU.

Use Structure

Checkbox

Optional

Enables the use of Structure.

In Progress

Boolean Tag

Optional

Status Bit that specifies a Write Request is in progress inside of the CPU (sent from the instruction but not yet sent out the Ethernet Port). The Status Bit reflects the Status of the individual Write Request.

Complete

Boolean Tag

Optional

Status Bit that specifies a Write  Request has been sent and a reply has been received, but it may not necessarily have been a good reply.  The Status Bit reflects the Status of the individual Write Request.

Success

Boolean Tag

Optional

Status Bit that specifies a Write Request has been sent and a good reply has been received.  The Status Bit reflects the Status of the individual Write Request.

Error

Boolean Tag

Optional

Status Bit that specifies a Write Request has been sent and a reply with an Error has been received from the Slave device within the specified Timeout period.  Check the Exception Response String to see if it's an Error returned from the Slave device or check the Error Logs to see if it is an Internal Error.  The Status Bit reflects the Status of the individual Write Request.

Timeout

Boolean Tag

Optional

Status Bit that specifies a Write Request has been sent but no reply was received within the specified Timeout value time. Timeout >value is set up in the External Ethernet Port and RS232/RS485 Serial Ports of theHardware Configuration.  The Status Bit reflects the Status of the individual Write Request.

Exception Response String

String

Optional

String that holds the exception response Error.  View the Communication Error Codessection of the help file for detailed information on Error Codes and possible corrective actions.

Automatic Polling

Checkbox

Optional

The CPU will send out a request at the specified Poll Rate + Offset Time Value (msec).

 

Parameter

Parameter Type

Requirements

Description

Skip Execution if Buffer is Greater Than

Checkbox

Optional

Used with Automatic Polling, allows the user to back-off an instruction if the buffer is getting too full (for CPU ports only).  Set by a percentage.  See more details in the Communications topic.

Remote Project

Constant

Must Have

Allows the user to select the Project's Tagname Database of the CPU that the instruction is targeting.  Use the Read button to view Remote Projects.

Non- Array

Selectable Option

Must Select Non-Array or Array

Allows the user to specify non-sequential Tags that can be Written to the Write Request.  The number of Tags entered will determine the size of the Request.

Tags of This Project

Numerical Tag

Must Have when Non-Array is Selected

Allows the user to select the Tags of this Project/CPU that the data will be Written from.  Enabled when Non-Array is selected.

Tags of Remote Project

Numerical Tag

Must Have when Non-Array is Selected

Allows the user to select the Tags in the target Project/CPU that the data will be Written to.  Enabled when Non-Array is selected.

Array

Selectable Option

Must Select Non-Array or Array

Allows the user to select the starting Tag in the sequential number of Tags that will be Written to the Write Request.

Array Tag of This Project

Numerical Tag

Must Have when Array is Selected

Allows the user to select an Array Tag of this Project/CPU that the data will be Written from.  Enabled when Array is selected.

Array Tag of Remote Project

Numerical Tag

Must Have when Array is Selected

Allows the user to select an Array Tag in the target Project/CPU that the data will be Written to. Enabled when Array is selected.

Starting Index

Constant

Must Have when Array is Selected

Starting Index position within the specified Array.  Enabled when Array is selected.

End Index

Constant

Must Have when Array is Selected

Ending Index position within the specified Array.  Enabled when Array is selected.

String Tag of This Project

String Tag / Constant

Must Have when String is Selected

Allows the user to select a String Tag of this Project/CPU that the data will be Written from. Enabled when String is selected.

String Tag of Remote Project

String

Must Have when String is Selected

Allows the user to select a String Tag in the Project/CPU that the data will be Written to. Enabled when String is selected.

Number of Characters

Constant

Must Have when String is Selected

Enter number of characters, max 128.


Note: Communications using this instruction are performed through the External Ethernet Port located on the CPU.
P1 Single Ethernet Port Upper (P3) or forward (P2) of the Dual Ethernet Ports RS232 Port CPU (RJ12 Port) RS485 Port (3-pin Terminal Block) usesModbus based protocol exclusive to the P Series CPUs.


Note: For Automatic Polling, the instruction will execute at the selected Poll Rate + the Poll Rate Offset if used.


Note: Tag Values are updated immediately as each Ladder Rung is executed, top to bottom.  However, Tag Values representing physical Outputs are only applied to the physical Output after the END statement of the last Task to be scanned is reached.  Outputs in Remote Base Groups have additional limitations regarding Update Intervals.


Note: Auto polling minimum value is determined by the end device response time. If you are getting errors due to requesting data too frequently, the auto polling rate will need to be increased until error condition clears.



Instruction Configuration

When Network Write Instruction is selected the window shown below opens with defaults shown.



Parameter Configuration Table

Network Write

Instruction

(WX)

Notes

* This icon indicates to use 1D Array data types of the respective Data Type column.

Ethernet Port

                   

Select if Ethernet Port is used.

IP Address

                 

Enter an IP Address.

TCP Port Number

                 

Enter TCP Port Number.  Default is 502.

Serial Port

                   

Select if Serial Port is used.

Slave Node Number

                 

Enter a Slave Node Number.  Default is 1.

Use Structure

                   

Select if Structures are used.

In Progress

                 

Select a Boolean Tag for In Progress.

Complete

                 

Select a Boolean Tag for Complete.

Success

                 

Select a Boolean Tag for Success.

Error

                 

Select a Boolean Tag for Error.

Timeout

                 

Select a Boolean Tag for Timeout.

Exception Response String

               

 

Select a String Tag for Response Errors.

Automatic Polling

                   

Select and enter Polling Time and Offset Time (msec).

Skip Execution

                   

Select and enter % Value.

Remote Project

                   

Select desired Remote Project.

Non-Array

                   

Select if Non-Array Mapping is desired.

Tags of This Project

   

Enter the desired Tagnames> to be Mapped for this Project.

Tags of Remote Project

   

Enter the desired Remote Project Tagnames to be Mapped.

Array

                   

Select if Array Mapping is desired.

Array Tag of This Project *

   

Enter the desired Tagnames to be Mapped for this Project.

Array Tag of Remote Project *

   

Enter the desired Remote Project Tagnames to be Mapped.

Starting Index

                   

Enter the Starting Point of Mapped Array.

Ending Index

                   

Enter the Ending Point of Mapped Array.

String

                   

Select if String Mapping is desired.

String Tag of this Project

               

Enter the desired Tagname to be Mapped for this Project.

String Tag of Remote Project

               

 

Enter the desired Remote Project Tagname to be Mapped.

Number of Characters

                 

Enter the number of Characters to be sent.

 

Timing Charts

 


Note: Another side effect of the queuing mechanism is that the instruction status bits may not be seen in the ladder. When an instruction has completed (Success, Exception Response, or Timeout), the CPU firmware will set the appropriate status bits. At the point that the CPU firmware pulls another message off the queue, it will reset the status bits of that instruction. The timing can work out in such a way that the status bits get set but the CPU firmware pulls off the instruction that contains those same status bits and resets them to start another iteration before the ladder code examines those bits.
Two things can be done to ensure reliable detection of status bits:
1. Do not use Automatic Poll and use interlocking logic to detect status completion of an instruction before enabling that instruction again. This is the most reliable method.
2. Ensure that the Automatic Poll time is long enough to prevent queueing of that same instruction.
See Communications Modbus Functionality help topic for more details.


Application Example

In the following example, the CPU Ethernet Port is performing a Network Write to two Tags in another CPU in the network.

Rung Example


Related Topics Link IconRelated Topics