Wait for String (Serial)

NI Vision Builder

Wait for String (Serial)

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

How to Use

  1. Select the port on whose line you want to receive a command from the Port drop-down list.
  2. Select whether you want to wait for a fixed number of bytes or a termination character.
  3. If you selected Termination Character, select the character you want to signal the end of the command from the drop-down list. Enable the Add Termination Character to Result String to add the selected Termination Character to the string result.
  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 Serial 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
Port Name of the serial port 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 Port.
  • Termination Char—When enabled, the step waits for the character that indicates the end of a command. The following options are available:
    • None—No termination character
    • NULL (\00)—Null character
    • CR (\0D)—Carriage return
    • LF (\0A)—Line feed
    • CR/LF (\0D\0A)—Carriage return/line feed
    • 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.
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.