Read Data from Serial Port

This action collects data received via serial port (RS-232) and saves it in a selected variable. Use this action to communicate with external serial port devices.

About group identifies the selected action.

  • Name: allows you to define a custom action name. This makes actions easily recognizable on the solution's list of actions. By default, the action name is taken from its type.
  • Description: custom information about the action. Enter a description to explain the purpose and role of action in a solution.
  • Action type: read-only information about the selected action type.

Port group defines the serial port.

  • Port name: name of the port to which an external device connects to. This can either be a hardware COM port or a virtual COM port.

Port Settings group defines additional port connection settings.

  • Bits per second: speed rate used by the an external device to communicate with the PC. The usual alias used with the setting is "baud rate".

  • Data bits: specifies the number of data bits in each character. 8 data bits are almost universally used in newer devices.

  • Parity: specifies the method of detecting errors in a transmission. The most common parity setting, is "none", with error detection handled by a communication protocol (flow control).

  • Stop bits: halts the bits sent at the end of every character allowing the receiving signal hardware to detect the end of a character and to resynchronize with the character stream. Electronic devices usually use a single stop bit.

  • Flow control: serial port may use interface signals to pause and resume the data transmission.

Example 110. Example

A slow device might need to handshake with the serial port to indicate that data should be paused while the device processes received data.

Options group includes the following settings:

  • Read delay: optional delay when reading data from serial port. After the delay, the entire content of the serial port buffer is read. Enter the delay manually or click the arrows to increase or decrease the value.

  • Send initialization data: specifies the string that is sent to the selected serial port before the data is read. This option enables the action to initialize the device to be able to provide the data. The option can also be used for sending a specific question to the device, and to receive a specific answer. Click the arrow button to enter special characters.

Data Extraction group defines how the defined parts of received data are extracted.

  • Start position: starting position for data extraction.

  • End position: ending position for data extraction.

Result group defines a variable for data storing.

  • Save data to variable: select or create a variable to store the received data.

Action Execution and Error Handling

Each action can be set as a conditional action. Conditional actions only run when the defined conditions allow them to be run. To define these conditions, click Show execution and error handling options.

Execution options are:

  • Enabled: specifies if the action is enabled or disabled. Only enabled actions will execute. This functionality may be used while testing a form.
  • Condition: defines one-line programming expression that must provide a Boolean value (true or false). When the result of the expression is true, the action will execute. Condition offers a way to avoid executing actions every time.

Error handling options are:

  • Ignore failure: specifies whether an error should be ignored. If enabled, the execution of actions continues even if the current action fails.

    Note

    Nested actions that depend on the current action do not execute in case of a failure. The execution of actions continues with the next action on the same level as the current action. The error is logged but does not break the execution of the action.

  • Example

    At the end of printing, you might want to send the status update to an external application using the HTTP Request action. If the printing action fails, action processing stops. In order to execute the reporting even after the failed print action, the Print Label action must have the option Ignore failure enabled.

  • Save error to variable: allows you to select or create a variable to save the error to. The same cause of the error is also saved to internal variables ActionLastErrorId and ActionLastErrorDesc.