
86 - IO Data Handling
DeviceMaster PNIO | UP User Guide
: 2000639 Rev. A
IO Data Handling
Output Data Handling
This subsection discusses the following topics:
•
•
•
Formatting an
Output Packet
To write output data, an output packet needs to be first assembled in the IO
controller’s memory using the format as shown in the Output Data Format table
(Page 82) of an Output Submodule. A typical way is to create a data block and
define a structure for output packet, as shown in the following figure.
Fill the structure with sequence number, length, and actual output data. Then use
the
DPWR_DAT
instruction to copy the entire packet to the output address of the
corresponding submodule. The packet is transmitted to the DeviceMaster in the
next IO update cycle.
Transmitting an
Output Packet
The actual transmission of output data through a port/device is triggered when
the sequence number changes. The DeviceMaster transmits the output data
(excluding the sequence number and length) to the corresponding port/device only
when the sequence number changes.
If the transmission is successful, the DeviceMaster copies the sequence number
into the input space of the submodule. The following figure shows the 2-byte input
data at address IW104 contains the last transmitted sequence number. After the
DPWR_DAT
instruction, compare the last transmitted sequence number with the
sequence number of the output packet, if they are the same, then the output data
has been transmitted successfully.
The DeviceMaster expects the sequence number to be incrementing for each
output packet. If a sequence number is out of order, the DeviceMaster still
transfers that packet, then logs an error message in the system log. If the length
field is invalid, that is, greater than the size of the output submodule, the
DeviceMaster will not transmit that packet. An error is logged and the last
transmitted sequence number input is not updated.