Topic: DMD0304 STREAMOUT - Stream Out Data to Device |
|
The Stream Out Data to Device (STREAMOUT) instruction is used to send data through to the specified, stream-capable device (like a serial port or an Ethernet port) from a String (if the data is ASCII text; maximum of 1024 bytes) or a numeric data block (if the data is binary; max of 1024 bytes). Up to 64 bytes can be sent from a String Short (SS) data type, up to 256 bytes can be sent from a String Long (SL) data type, and up to 1024 bytes can be sent from a user-defined String (which are created in System Configuration -> Memory Configuration -> Add Memory Block.
If the Data Source is a String you can use the Print to String (STRPRINT) instruction to build up the contents of the String. If the Data Source is a numeric data block containing binary data you can use the Put Bytes into a String (STRPUTB) instruction to store the bytes of data in the data block first.
|
|
Element References: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.
Device specifies which stream device will send the output data.
Data Source selects where the data to send to the stream device is currently stored. The option chosen will depend on the type of data that is to be sent by the stream device. If the data is ASCII text the appropriate location is a String Structure. If the data is binary or simple bytes of data the appropriate choice is a numeric block of bytes.
Endian Settings specifies
optional processing to handle the Byte and Word ordering of the data. Select both options to swap the Bytes in each of the Words and swap the
Words in each of the DWord elements.
Flush INPUT device first: for Devices that have an input buffer (for example a serial port Device), optionally clear the Device's input buffer before sending the output data through that device.
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.
|
|
Stream Device Structure Fields:A STREAMOUT instruction will reference a Stream Device A pre-configured device that is capable of communicating via connection-oriented protocols like Modbus TCP/IP (over Ethernet) or Modbus/RTU (over serial).. Each Stream device has an associated structure which contains the following member fields:
|
|
Status Display:
The red triangle in the upper left corner of the status display indicates this is a Fully Asynchronous instruction.
The gray triangle at the right end of the input leg indicates the input is edge-triggered, meaning this instruction will execute each time the input logic transitions from OFF to ON.
The Status display for the String or Numeric Block will only display as many of the characters of the destination location as will fit within the borders of the instruction, typically this is about 50 characters.
|
|
See Also:STREAMIN - Stream In Data from Device
STREAMOUT - Stream Out Data to Device
|
|
Related Topics:PACKETIN - Input Data from Packet Device
PACKETOUT - Output Data to Packet Device
|
|
Example Using Stage:
Rung Example:
|
|