Siemens S7 Client Communication

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.

Communication Workflow

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

You can check Input signals and Output Signals to learn the meaning of each signal.
handshake flow

Input Signals (from the PLC to Mech-MSR)

Name Description Data type DB offset

CMD_ENABLE

The signal to enable the command.

Boolean

0.0

CMD_TRIGGER

The signal to trigger the command.

Boolean

0.1

DATA_READ_FINISHED

The data is read.

Boolean

0.2

RESET

The output data is reset.

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

The command code.

Integer

4.0

CMD_PARAM_1

The command parameter 1.

Integer

6.0

CMD_PARAM_2

The command parameter 2.

Integer

8.0

CMD_PARAM_3

The command parameter 3.

Integer

10.0

CMD_PARAM_4

The command parameter 4.

Integer

12.0

WORD_SPARE

A reserved field.

Word (0 to 8)

14.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 command trigger acknowledge signal, the command trigger signal can be set to 0.

DATA_READ_FINISHED

When the PLC completes data reading, this signal will 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

The 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.

You can check Project List of Mech-MSR to learn how to view the ID of a project.

Output Signals (from the PLC to Mech-MSR)

Name Description Data type DB offset

HEARTBEAT

The heartbeat signal.

Boolean

32.0

TRIGGER_ACKNOWLEDGE

The trigger acknowledge signal, which acknowledges the command trigger signal.

Boolean

32.1

DATA_READY

The data ready signal.

Boolean

32.2

EXEC_COMPLETED

The execution completed signal, which indicates that the command execution is completed.

Boolean

32.3

BIT_SPARE_1

A reserved field.

Boolean

32.4

BIT_SPARE_2

A reserved field.

Boolean

32.5

BIT_SPARE_3

A reserved field.

Boolean

32.6

ERROR

The error signal.

Boolean

32.7

OVERALL_JUDGE

The overall judge signal.

Boolean

33.0

JUDGE_SPARE_1

A reserved field.

Boolean

33.1

JUDGE_SPARE_2

A reserved field.

Boolean

33.2

JUDGE_SPARE_3

A reserved field.

Boolean

33.3

JUDGE_SPARE_4

A reserved field.

Boolean

33.4

JUDGE_SPARE_5

A reserved field.

Boolean

33.5

JUDGE_SPARE_6

A reserved field.

Boolean

33.6

JUDGE_SPARE_7

A reserved field.

Boolean

33.7

BYTE_SPARE_1

A reserved field.

Byte

34.0

BYTE_SPARE_2

A reserved field.

Byte

35.0

STATUS_CODE

The status code signal.

Integer

36.0

BYTE_SPARE_3

A reserved field.

Byte

38.0

BYTE_SPARE_4

A reserved field.

Byte

39.0

JUDGE

The judge signal.

Boolean (0 to 63 bits)

40.0

VALUE

The measure signal.

Floating-point (0 to 63 bits)

48.0

HEARTBEAT

System heartbeat that flips every 1 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 failing 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 0, an error occurred and this signal will be set to 1.

OVERALL_JUDGE

The overall judgement of the project. 0 indicates OK, and 1 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. You must complete the configuration to obtain a valid judgement result.

STATUS_CODE

Five status codes may be returned by Mech-MSR:

  • Normal status code: 0, which indicates that the command has been successfully executed.

  • Error codes: –1, –2, –3, and –4. For more information, see Error Codes.

JUDGE

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

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

VALUE

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

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

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.