Read from Serial Interface

This tool is set as legacy. It is still available to provide backward compatibility but it will no longer be maintained or updated in upcoming MERLIC versions.

Use this tool to read data from a serial interface.

Before trying to connect to a serial interface, please make sure that you have the required permissions.

Select the device to be read from the parameter "Port Name" and establish the connection to the interface by setting the parameter "Connect" to 1. Use the button for executing MERLIC once to execute this tool in single steps. This gives you the possibility to read the data step by step.

If a "Serial Handle" is connected from a previous tool, the parameters will be adopted from the first tool only. Thus, if you want to adjust the parameter settings in the current tool, you have to make the adjustments in the first tool, else the parameter changes will be ignored.

Execution Behavior

The behavior of this tool regarding the execution differs from the default behavior. Usually a MERLIC tool is executed in the following cases:

  • The MERLIC Vision App is explicitly executed in continuous mode.
  • The MERLIC Vision App is explicitly executed in "Run Once" mode.
  • A MERLIC Vision App with the tool is opened in the MERLIC Creator.
  • A parameter value of the tool has been changed in the MERLIC Creator.

However, the tool "Read from Serial Interface" is only executed in the following cases:

  • The MERLIC Vision App is explicitly executed in continuous mode.
  • The MERLIC Vision App is explicitly executed in "Run Once" mode.

This ensures that read and write operations are not applied when loading an MVApp or changing a parameter value of the tool. However, if the parameter "Connect" is set to 1, the tool still tries to establish a connection to the remote device.

Parameters

Basic Parameters

Port Name:

This parameter defines the name of the device from which the data are read. It is set to 'COM3' by default. The Port Name is operating system specific. On Windows machines typically the ports 'COM1'-'COM4' are used. However, you can also change its value by typing the desired port name into the input field of the connector.

Connect:

This parameter defines if the connection to the serial interface is activated or deactivated. The parameter is set to 0 by default. This means that the connection to the serial interface is not active and therefore the connection is not established for reading. If you want to start reading the data from the serial interface, you have to set the parameter to 1 to open the file for reading.

Since the tool is executed with every change of values, we recommend to set the parameter Connect to 0 until the tool has been completely configured.

Read Accesses per Cycle:

This parameter defines how many read accesses are permitted, i.e., how many characters will be read if the MERLIC Vision App is executed once. The parameter is set to 1 by default.

Baud Rate:

This parameter determines the input and output speed of the serial interface. It is set to 9600 by default. You can change the "Baud Rate" at the corresponding connector.

Number of Data Bits:

This parameter defines the number of the sent data bits. The parameter is set to 0 by default. You can change the "Number of Data Bits" at the corresponding connector.

Number of Stop Bits:

This parameter defines the number of the sent stop bits. The parameter is set to 0 by default. You can change the "Number of Stop Bits" at the corresponding connector.

Timeout Per Cycle:

This parameter defines the reading timeout for the cycle in which the MERLIC Vision App is executed once. It is defined in seconds and set to 0.1 s by default. You can change the timeout at the corresponding connector to a value between 0 and 1.

Timeout Per Read Access:

This parameter defines the reading timeout for a single read access. It is defined in seconds and set to 0.1 s by default. You can change the timeout at the corresponding connector to a value between 0 and 1.

Additional Parameters

Serial Handle:

This parameter can be used to specify the handle of the serial interface from which the data are read, i.e., from the previous tool, where a serial handle is already defined.

Please make sure that this parameter is not connected to the handle of a different Read from Serial Interface tool. This ensures that all data will be read in this tool.

Flow Control:

This parameter determines what kind of data flow control should be used. It is set to "unchanged" by default. You can change the Flow Control type at the corresponding connector.

Value

Description

none

No flow control is used.

cts_rts

Hardware control is used.

dtr_dsr

Hardware control is used.

xon_xoff

Software control is used.

dtr_dsr xon_xoff

A combination of hardware control and software control is used.

cts_rts xon_xoff

A combination of hardware control and software control is used.

cts_rts dtr_dsr

A combination of hardware controls is used.

cts_rts dtr_dsr xon_xoff

A combination of hardware controls and software control is used.

unchanged

The current flow control is used.

Parity:

This parameter defines what kind of parity check of the transmitted data is performed. It is set to "unchanged" by default. You can change its value at the corresponding connector.

Value

Description

none

No parity check is performed.

odd

Checks, if the number of bits in the data with the value one is odd.

even

Checks, if the number of bits in the data with the value one is even.

unchanged

The current parity check type is used.

Results

Basic Results

Data:

This result contains the data that were read from the serial interface as an integer number.

Tool State:

"Tool State" returns information about the state of the tool and thus can be used for error handling. For more information, see Tool State Result

Additional Results

Data as String:

This result returns the data that were read from the serial interface as a string. The read data are automatically converted from bytes to one string. This enables you to access the data also as a string in addition to the Data result which is returned as integer. Note, that in case a null character (0x00) is read, the symbol is not converted into a string and will be omitted.

Serial Handle Used:

This parameter represents the handle of the serial interface from which the data are read. It can be used by a following tool to write or read. It should be avoided that several tools use the same handle to read from the same serial interface or write to the same serial interface simultaneously since this may lead to unexpected effects.

Processing Time:

This result returns the duration of the most recent execution of the tool in milliseconds. The result is provided as additional result. Therefore, it is hidden by default but it can be displayed via the button beside the tool results. For more information see the section Processing Time in the tool reference overview.