Wait for String (TCP)

NI Vision Builder

Wait for String (TCP)

Use this dialog box to configure your system to wait for an incoming command.

How to Use

  1. Select the device you want to receive a command from the Device Name drop-down list.
  2. Select whether you want to wait for a fixed number of bytes or a specified termination character or character set.
  3. If you selected Termination Character, enter the termination character or character set you want to signal the end of the command. Enable the Add Termination Character to Result String to add the selected Termination Character to the string result.
    Tip  Change the Display type to enter the termination character in hexadecimal or \ codes.
  4. Type the number of milliseconds to wait for the command before timing out.
  5. Select the Pass condition for the step. If you want the inspection to pass only when a specific string is received, select String received before timeout matches, and enter the expected string. Also, enable the Inspection fails in case of error or timeout control located on the TCP I/O property page.
    Tip  You can use the following wildcard characters in the expected string:

    CharacterDescription
    %dmatch decimal integer
    %omatch octal integer
    %xmatch hexadecimal integer
    %bmatch binary integer
    %ematch scientific real number
    %fmatch floating-point real number
    %gmatch floating-point or scientific real number
    %%match a single % character
  6. Type a comment about the command you expect to receive.

Control Descriptions

The following controls are found on the Wait for String dialog box.

Control Name Description
Device Name Name of the device from which you expect to receive a command.
Wait For Specifies how long the step waits for a command. The following options are available:
  • Fixed Number of Bytes—When enabled, the step waits for the specified number bytes from the device specified in Device Name.
  • Termination Char—Character that indicates the end of a command.
  • Add Termination Character to Result String—When enabled, appends the selected Termination Character to the received string.
Timeout Number of milliseconds to wait for the string before timing out.

For TCP slave devices, if a timeout occurs, the step returns the characters received before the timeout.

For TCP master devices, if a timeout occurs, no characters are returned.

Pass Inspection If Specifies the Pass condition for the step. The following options are available:
  • Any string is received before timeout—Step passes if a string is received, regardless of the value, before the specified Timeout.
  • String received before timeout matches—Step passes if the value of the string received before the specified Timeout matches the specified value. You may also specify how to display the string.
Comment Comment about the command you expect to receive.