Share this

Knowledge Sharing on S7-200 Series PLC Free Port Communication (3)

2026-04-06 06:58:33 · · #1

In previous articles, we shared the sending function in freeport communication. Now, let's discuss the receiving function. The challenge in freeport communication lies in using the receiving function. When the PLC sends data to the lower-level device through the communication port, the lower-level device will send back corresponding data based on the information sent by the PLC. At this point, the PLC needs to use the receiving function to receive the data. The S7-200 series PLC provides a receive instruction (RCV) for receiving information returned by the lower-level device. The instruction format is as follows:

After the PLC receives the data transmitted back from the lower-level device, it will generate a corresponding interrupt event to notify the programmer that the data reception is complete. At this time, the corresponding program can be written to extract the valid data and convert it into readable data. The S7-200 series PLC provides interrupt events 23 and 24 as the interrupt event numbers for the completion of reception on ports 0 and 1, respectively.

During PLC information transmission, the PLC is the active party, sending data according to the required number of data items. Once transmission is complete, the PLC automatically generates a corresponding transmission completion interrupt. For the receiving party, the PLC is the passive party, only responsible for receiving data. When the PLC port has its receive function enabled, the PLC is in a waiting state, receiving data as it arrives. However, the PLC doesn't know whether the received data is valid or when it has finished receiving data. This requires programmers to set the start and receive conditions for the received data. When the start condition is met, the PLC puts the received data into the receive buffer. When the end condition is met, the PLC shuts down the receive function and generates a receive completion interrupt.

There are many ways to determine the start and end conditions of a message, but the following are some of the more commonly used methods:

Today we'll discuss the process and program settings for determining the start and end of a message using a start character and an end character. The S7-200 series PLC provides two system storage areas for storing the start character (SMB88) and the end character (SMB89) (using port 0 as an example). Therefore, if you need to use the start and end characters to determine the start and end of a message, you need to put the start character and end character into SMB88 and SMB89 respectively.

When the PLC is receiving data, it compares the received data with the start character. If the data is not equal to the start character, it means that the data is not valid and will not be put into the receive buffer. The received data will be discarded and received again. If the received data is equal to the start character, the PLC will put the received data into the receive buffer and increment the value of the memory that records the number of received characters by 1.

Once the start character is satisfied, the PLC compares the received character with the end character. If they are not equal, data reception continues. If the received data matches the end character, the reception function is disabled, and a reception completion interrupt is generated. Therefore, when using start and end characters, most of the time specific characters are used.

If start and end characters are used to determine the start and end of a message, the control byte (SMB87) of the receive function must first be configured to inform the PLC to use start and end characters to determine the start and end of the message. The format of SMB87 is shown in the following figure:

Read next

CATDOLL Sabrina Soft Silicone Head

You can choose the skin tone, eye color, and wig, or upgrade to implanted hair. Soft silicone heads come with a functio...

Articles 2026-02-22