Topic: DMD0303 STREAMIN - Stream in Data from Device |
|
|
|
The Stream in Data from Device (STREAMIN) instruction is used to retrieve data from a stream-capable input device (like a serial port) and store that data in either a String (if the data is ASCII text) or a numeric data block (if the data is binary).
|
|
|
|
The first time that a STREAMIN instruction is placed in a project this message will be displayed. This message alerts the user that the implementation will determine what type of internal storage will be required to store the data retrieved by the instruction.
The default memory configuration has STRINGs which can be used to store ASCII text, and blocks of Words and DWords that can be used to store integer and floating point data. But many communication protocols are constructed using Bytes and the Do-more controller does NOT have a pre-configured block of Unsigned Bytes. If a Byte buffer is needed, clicking Yes will open the Create Unsigned Byte Buffer Block dialog were one can be created. |
|
|
|
Block Name (1 to 16 letters) - specifies the name of the data block to create, the default name STREAMINBuff can be changed if desired. Block names must be unique, and consist of 1 to 16 characters (A-Z, a-z; no numbers, no spaces).
Number of Bytes (multiple of 4) - specifies the size of the data block to create. Data blocks must be created on DWord (4-byte boundaries)
Block Range - displays the first and last element of the block that will be created based on the current entries for Block Name and Number of Bytes
Make data block retentive (retain values after power loss) - check this option to make the entire data block retentive which will preserve the contents of the block if the system power is lost. |
|
Element References:Note: Use the F9 key (Element Browser) or Down-Arrow key (Auto-Complete) at any time to see a complete list of the memory locations that are valid in the current field of the instruction.
Device
- designates which of the configured Devices to read the data from. Before
this instruction can select a Device, that Device must be configured to
accept data from an external source. Part of the configuration for a device
is assigning a name to the device. It is that name which will show up
in the Device selection drop-down menu. For more information on configuring
devices go to the Device
Configuration Section under System Configuration.
Complete When ... - this group of options sets the condition (or conditions) that are used to signal the completion of the Stream in Data from Device (STREAMIN) instruction. Any combination of the following three options can be used to signal the completion of the instruction:
The Terminal Emulation Client Support allows the Stream in Data from Device (STREAMIN) instruction to perform some extra processing of the input data if the source of that data is a terminal emulator program. Enabling this option will cause the Stream in Data from Device (STREAMIN) instruction to perform a 'backspace' operation if a CTRL-H (0x08) character is received by removing the previous character in the input data buffer before the data buffer is stored in the destination location.
If this option left is disabled the Stream in Data from Device (STREAMIN) instruction will not post-process any of the data, it will leave both the previous character and the 'backspace' character (CTRL-H) in the input data buffer and both characters will be stored in the destination location.
|
|
Data Destination - selects where to store the data that has been read from the Stream Device. The option chosen will depend on the type of data that is received from the Stream Device. If the data is ASCII text the appropriate choice is 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
Note: select both options to swap the Bytes in each of the Words and swap the Words in each of the DWord elements
On Success: - designates one of the following two options if the Stream in Data from Device operation is successful:
On Error: - designates one of
the following two options if the Stream in Data from Device operation
is unsuccessful:
|
|
|
|
Status Display:The red triangle in the upper left corner indicates this is a Fully Asynchronous instruction.
The gray triangle at the right end of an input leg indicates the input
is edge
triggered
The Status display of the Stream In Data from Device instruction 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:
|
|
|
|
Example Using Stages:
|
|
|
|
Rung Example:
|
|
|