Set Up Communication Between External Device and Mech-MSR via TCP ASCII
About TCP ASCII
TCP ASCII is a communication mode based on TCP connections and ASCII string commands. It can be used for interaction between external devices such as PLCs and Mech-MSR. In this communication mode, the external device acts as the TCP client and Mech-MSR acts as the TCP server. After the connection is established, the external device can trigger a project to run and obtain data such as judgment results and measurement results by sending string commands.
This communication mode is simple to configure and easy to debug. It is suitable for scenarios in which string commands are used to control project execution or read results. Before you read the following content, make sure that the communication configuration has been completed in Mech-MSR.
Communication Workflow
Depending on the on-site control method, TCP ASCII communication can follow either of the following workflows:
-
If the external device needs to actively send commands to trigger project execution and obtain results as needed, see Communication Workflow (Command-Based).
-
If Mech-MSR needs to automatically push results to the client after project execution, see Communication Workflow (Command-Free).
Communication Workflow (Command-Based)
The workflow of TCP ASCII communication based on commands is shown in the figure below.
|
The workflow is as follows:
-
A TCP client (such as a PLC) establishes a TCP connection with the 3D measurement system (Mech-MSR).
-
The TCP client sends a
triggercommand to trigger the project to run. -
Mech-MSR returns the command status code. For example, if the project is triggered successfully, Mech-MSR returns
1. -
The TCP client sends a
returncommand to obtain the measurement results. After Mech-MSR receives the command, it starts the countdown for 10 seconds. -
Mech-MSR returns results. For example, if the project is run successfully, Mech-MSR returns the measurement results. If the project has not finished running within 10 seconds, Mech-MSR returns the error code
-3.
Communication Workflow (Command-Free)
The TCP ASCII communication mode enables the 3D measurement system (Mech-MSR) to automatically push results to the client such as a PLC after each project execution, without requiring the client to send a request command. This mode is suitable when the laser profiler is in the Continuous Acquisition Mode or when project execution is triggered through I/O terminals.
The workflow is as follows:
-
When configuring TCP ASCII communication, select Auto-push Results.
-
Set Data format of return commands. Mech-MSR will automatically push the results in the specified data format.
-
(Optional) Configure the project execution conditions. For example, set Run on Image Update in the project toolbar.
-
The TCP client establishes a communication connection with the 3D measurement system.
-
After each project run, Mech-MSR automatically pushes the results to the client.
The next section, TCP ASCII Commands, describes the supported commands and how to interpret the returned results.