Siemens S7 Client Communication

You are currently viewing the documentation for the latest version (2.2.1). To access a different version, click the "Switch version" button located in the upper-right corner of the page.

■ If you are not sure which version of the product you are currently using, please feel free to contact Mech-Mind Technical Support.

Mech-MSR can communicate with external devices by using the Siemens S7 protocol where the software acts as the client. Before you read the following content, make sure that the communication configuration has been completed in Mech-MSR.

About Siemens S7 Client

Communication can be established between a Siemens SIMATIC S7 PLC and Mech-MSR based on the Siemens S7 protocol by using the TIA Portal software. Under this communication mode, Mech-MSR acts as the client and the PLC acts as the server.

Hardware and Software Requirements

Hardware

  • The following S7 series PLCs from Siemens are supported:

    • S7-300: Integrated PN network port or CP343-1

    • S7-400: Integrated PN network port or CP443-1

    • S7-1200: No special requirement for modules

    • S7-1500: No special requirement for modules

  • Power adapter: 220V AC to 24V DC

  • Supports the following industrial personal computer (IPC):

    • The standard IPC provided by Mech-Mind (recommended)

    • User-provided device

  • Ethernet cable

Software

  • Siemens PLC programming software TIA Portal V15.1

  • 3D measurement and inspection software Mech-MSR (latest version 2.2.1 recommended)

  • Interface file for S7 communication between Siemens TIA Portal and Mech-MSR: MM MSR Interface.db (for data communication)

  • The interface file must be MM MSR Interface Supporting String.db for the transmission of string data.

  • The MM MSR Interface.db and MM MSR Interface Supporting String.db files are located in center/MSR_Interface/Siemens S7 under the software installation directory of Mech-MSR. Please copy and paste the files to the computer where the TIA Portal software is installed.

  • Do not use the MM MSR Interface DB as the IN/OUT interface parameters. The reason is that the PLC reads and writes the IN/OUT interface parameters in each scan cycle. If the DB remains in the enabled status, data already sent by the 3D measurement system can be overwritten. To avoid such a problem, data structures ToCamera and FromCamera should be used as the OUT and IN interface parameters, respectively.

Communication Workflow

The workflow of Siemens S7 Client communication is shown in the figure below.

See Input Signals and Output Signals to learn the meaning of each signal.
handshake-workflow

Input Signals (from the PLC to Mech-MSR)

Name Description Data type DB offset

CMD_ENABLE

Command enable

Boolean

0.0

CMD_TRIGGER

Command trigger

Boolean

0.1

DATA_READ_FINISHED

Data read finished

Boolean

0.2

RESET

Reset output data

Boolean

0.3

BIT_SPARE_1

A reserved field

Boolean

0.4

BIT_SPARE_2

A reserved field

Boolean

0.5

BIT_SPARE_3

A reserved field

Boolean

0.6

BIT_SPARE_4

A reserved field

Boolean

0.7

BYTE_SPARE_1

A reserved field

Byte

1.0

BYTE_SPARE_2

A reserved field

Byte

2.0

BYTE_SPARE_3

A reserved field

Byte

3.0

COMMAND

Command code

Integer

4.0

CMD_PARAM_1

Command parameter 1

Integer

6.0

CMD_PARAM_2

Command parameter 2

Integer

8.0

CMD_PARAM_3

Command parameter 3

Integer

10.0

CMD_PARAM_4

Command parameter 4

Integer

12.0

CMD_PARAM_5

Command parameter 5

Integer

14.0

CMD_PARAM_6

Command parameter 6

Integer

16.0

CMD_PARAM_7

Command parameter 7

Integer

18.0

CMD_PARAM_8

Command parameter 8

Integer

20.0

CMD_PARAM_9

Command parameter 9

Integer

22.0

CMD_PARAM_10

Command parameter 10

Integer

24.0

VAR_1

Variable 1

Float

26.0

VAR_2

Variable 2

Float

30.0

VAR_3

Variable 3

Float

34.0

VAR_4

Variable 4

Float

38.0

VAR_5

Variable 5

Float

42.0

VAR_6

Variable 6

Float

46.0

VAR_7

Variable 7

Float

50.0

VAR_8

Variable 8

Float

54.0

VAR_9

Variable 9

Float

58.0

VAR_10

Variable 10

Float

62.0

WORD_SPARE

A reserved field

Word (0–30)

66.0

CMD_ENABLE

Only when the command enable signal is set to 1, other input signals take effect.

CMD_TRIGGER

When the command trigger signal changes from 0 to 1 (a rising edge is detected), Mech-MSR reads command codes and command parameters. When Mech-MSR returns the trigger acknowledge signal, the command trigger signal can be set to 0.

DATA_READ_FINISHED

When the PLC completes data reading, this signal can be set to 1. When the data ready signal changes to 0, this signal can be set to 0.

RESET

When this signal is set to 1, the PLC clears the received judgement result and measurement result. At this point, the PLC can send new commands and status code signals are reset.

COMMAND

The following table describes the commands supported by the Siemens S7 Client communication, the command codes, and the command parameters.

Command Command code Command parameter Description

execute

1

The project ID. Only one project ID can be set each time.

Used to trigger the project and obtain project judgement result and measurement result.

trigger

2

Project ID. One to four project IDs can be set at a time.

Used to trigger the project to run.

return

3

The project ID. Only one project ID can be set each time.

Used to obtain the judgement result and the measurement result of the specified project.

judge

4

Used to obtain the overall quality judgment result of the specified project or the judgment results of individual measurement items.

value

5

Used to obtain the measured values of a specified project.

recipe

6

Project ID, parameter recipe ID

Used to switch the parameter recipe used by the project.

solution

7

Solution ID.

Used to switch the solution.

SetNumVar

8

ID of a global variable. Only one ID can be set at a time.

Used to set values for global variables of numeric type. The value of the variable is passed through VAR_INPUT.

GetNumVar

9

ID of a global variable. Only one ID can be set at a time.

Used to read the value of a global variable of numeric type. The result is returned by VALUE.

VAR_INPUT

When SetNumVar is executed, the set value is set to VAR_INPUT.

Name Description Data type DB offset

VAR_1

Variable 1

Float

26.0

VAR_2

Variable 2

Float

30.0

VAR_3

Variable 3

Float

34.0

VAR_4

Variable 4

Float

38.0

VAR_5

Variable 5

Float

42.0

VAR_6

Variable 6

Float

46.0

VAR_7

Variable 7

Float

50.0

VAR_8

Variable 8

Float

54.0

VAR_9

Variable 9

Float

58.0

VAR_10

Variable 10

Float

62.0

Output Signals (from the PLC to Mech-MSR)

Name Description Data type DB offset

HEARTBEAT

Heartbeat signal

Boolean

128.0

TRIGGER_ACKNOWLEDGE

Trigger acknowledge

Boolean

128.1

DATA_READY

Data ready

Boolean

128.2

EXEC_COMPLETED

Execution completed

Boolean

128.3

BIT_SPARE_1

A reserved field

Boolean

128.4

BIT_SPARE_2

A reserved field

Boolean

128.5

BIT_SPARE_3

A reserved field

Boolean

128.6

ERROR

Error

Boolean

128.7

OVERALL_JUDGE

Overall judge

Boolean

129.0

JUDGE_SPARE_1

A reserved field

Boolean

129.1

JUDGE_SPARE_2

A reserved field

Boolean

129.2

JUDGE_SPARE_3

A reserved field

Boolean

129.3

JUDGE_SPARE_4

A reserved field

Boolean

129.4

JUDGE_SPARE_5

A reserved field

Boolean

129.5

JUDGE_SPARE_6

A reserved field

Boolean

129.6

JUDGE_SPARE_7

A reserved field

Boolean

129.7

BYTE_SPARE_1

A reserved field

Byte

130.0

BYTE_SPARE_2

A reserved field

Byte

131.0

STATUS_CODE

Status code

Integer

132.0

BYTE_SPARE_3

A reserved field

Byte

134.0

BYTE_SPARE_4

A reserved field

Byte

135.0

JUDGE

Judgment result

Boolean (0-63)

136.0

VALUE

Measurement results and variable values

Float (0–63)

144.0

HEARTBEAT

System heartbeat. It toggles every second. Used to determine whether the PLC and Mech-MSR are connected or disconnected.

TRIGGER_ACKNOWLEDGE

When Mech-MSR receives the rising edge for the command trigger signal, this signal is set to 1. When a falling edge is detected for the command trigger signal, this signal is set to 0.

DATA_READY

Mech-MSR writes data to output ports and waits for the PLC to read the output data. When the data read signal is set to 1, this signal is set to 0.

EXEC_COMPLETED

When the command execution completes, this signal is set to 1, which indicates that the command execution is completed.

ERROR

If the status code returned by Mech-MSR is not 1, an error occurred and this signal is set to 1.

OVERALL_JUDGE

The overall judgement of the project. 1 indicates OK, and 0 indicates NG.

You need to set quality judgment rules for the project in the Output Management window in Mech-MSRand determine the measurement items to be considered. Only after the configuration is complete can valid judgment results be obtained.

STATUS_CODE

The possible returned status codes for Mech-MSR are as follows:

  • Normal status code: 1, indicating that the command was executed successfully.

  • Error codes: -1, -2, -3, -4, -5. For more information, see Error Codes.

JUDGE

Judgement results were added for measurement items on the Communication output tab in the Output Management window. 1 indicates OK, and 0 indicates NG.

At most 64 judgement results can be output for a single project at a time.

VALUE

The VALUE module returns the following data:

  • Measurement results are added for measurement items on the Communication output tab in the Output Management window.

  • The values of numeric global variables are read when theGetNumVarcommand is executed.

At most 64 measurement results can be output for a single project at a time.

Is this page helpful?

You can give a feedback in any of the following ways:

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.