Configure Communication in Mech-MSR

This section introduces how to set up the communication between Mech-MSR and an external device to transfer measurement and inspection data.

After configuring the communication and enabling the communication service in the Communication Configuration window of Mech-MSR, you can trigger a Mech-MSR project to run and obtain measurement and inspection results with external devices, such as PLCs.

It is recommended to manage output before communication configuration.

Configure TCP ASCII Communication

The Mech-Mind 3D Measurement System supports TCP ASCII communication with external devices.

Follow these steps to configure TCP ASCII communication:

  1. On the toolbar of Mech-MSR, click Communication Configuration.

  2. (Optional) In the Communication Configuration window, set the Port parameter as required.

    The default value of the Port parameter is 5000. After the TCP ASCII communication service is enabled, the software listens to TCP ASCII commands sent by external devices at the specified port.

    config tcp ascii
  3. (Optional) Set the Data format of return commands parameter by referring to Set Data Format of Return Commands.

    The Data format of return commands parameter is used to customize the format of the data returned by the software to the return commands.

  4. (Optional) Set other data formats by referring to Set Other Data Formats.

  5. (Optional) Select the Auto-enable the service option according to your actual needs. If the option is selected, the software automatically enables the TCP ASCII communication service every time the software is started.

  6. Click communication setting open icon to start the TCP ASCII communication service.

After the TCP ASCII communication service is started successfully, the status of TCP ASCII is displayed as Running.

enabled tcp ascii
The previous procedure can also be used to modify the configuration of TCP ASCII communication. Note that the current communication configuration modification only takes effect for subsequent command requests.

Set Data Format of Return Commands

After a return command is sent by an external device, the software can return results according to the set Data format of return commands.

Supported data formats

The returned data for the return command supports the following fields. You can combine them according to your needs.

Field Description

%time

Image acquisition time in the format of 20200101010101100 (01:01:01 sec, 100 ms, 01/01/2020).

%judge

The overall quality judgment result of the project. 0 is OK, and 1 is NG.

%value[ID value of measurement item]

The measured value of the specified measurement item.

For example, %value[1] indicates the measured value of the measurement item with an ID value of 1 in the Communication output tab.

%value[%id]

The measured values of all configured measurement items in the Communication output tab.

%judge[ID value of measurement item]

The judgment result of the specified measurement item. 0 stands for OK, and 1 for NG.

For example, %judge[1] represents the judgment result of the measurement item with an ID value of 1 in the Communication output tab.

%judge[%id]

The judgment results of all configured measurement items in the Communication output tab.

Measured Value and Judgment Result

Measured value of a measurement item

Mech-MSR will return measured values to an external device only if the following conditions are met:

  • In the Communication output tab of Mech-MSR’s Output Management window, the measurement item has been added to the Output area. The ascending order of ID values of measurement items is the order of returned results.

    measurement item id
  • In the Communication Configuration window, the value of the Data format of return commands parameter contains either “%value[%id]” or “%value[ID value of the measurement item]”.

Judgment result of a measurement item

For the judgement result of a measurement item, 0 stands for OK, and 1 for NG. Mech-MSR will return the judgment result to an external device only if the following conditions are met:

  • In the Communication output tab of Mech-MSR’s Output Management window, the measurement item has been added to the Output area. The ascending order of ID values of measurement items is the order of returned results.

  • In the Communication Configuration window, the value of the Data format of return commands parameter contains either “%judge[%id]” or “%judge[ID of the measurement item]”.

Examples

Suppose that the Communication output tab contains three measurement items, whose IDs are 1, 2, and 3.

Examples Description

1

Data format

%judge,%value[%id],%judge[%id]

Returned result

0, 100, 0, 200, 0, 300, 0

Mapping relationship

%judge,%value[1],%judge[1],%value[2],%judge[2],%value[3],%judge[3]

2

Data format

%judge, M%id, %value[%id], %judge[%id]

Returned result

0, M1, 100, 0, M2, 200, 0, M3, 300, 0

Mapping relationship

%judge,M1,%value[1],%judge[1],M2,%value[2],%judge[2],M3,%value[3],%judge[3]

3

Data format

%judge, V%value[%id], J%judge[%id]

Returned result

0, V100, J0, V200, J0, V300, J0

Mapping relationship

%judge, V%value[1], J%judge[1], V%value[2], J%judge[2], V%value[3], J%judge[3]

Examples 2 and 3 are examples of adding character prefixes. In example 2, M%id stitches the character M together with the ID of the measurement item in the output. In example 3, V%value[%id] and J%judge[%id] add the characters V and J before the measured value and judgment result of each measurement item respectively.

Set Other Data Formats

You can set other data formats according to your needs.

Parameter Description

Floating-point decimal places

Specifies the number of decimal places to keep when the software outputs the measured values. The value ranges from 0 to 20. The default value is 4.

String delimiter

Specifies the delimiter used to separate data (between command name and parameter, and between parameters) in TCP command requests. Common string delimiters include the English comma (,) and semicolon (;). By default, the string delimiter is the English comma.

String terminator

Specifies the string terminator of commands. Common string terminators are \n and \r. By default, the terminator is \r.

Invalid value

Specifies the data format when there are no measured values or no judgment results. The default value is “invalid”.

We Value Your Privacy

We use cookies to provide you with the best possible experience on our website. By continuing to use the site, you acknowledge that you agree to the use of cookies. If you decline, a single cookie will be used to ensure you're not tracked or remembered when you visit this website.