Share this

Implementation of free-port communication between Siemens S7-200 and AnKong Super E40 series RTU module system

2026-04-06 07:38:40 · · #1

Abstract: This paper introduces the communication between a Siemens S7-200 PLC and an AnKong Super E40 series RTU module system in free-port mode. It solves the problem of how the AnKong RTU module, lacking an AO module, can control an electric ball valve by communicating with the Siemens PLC via its free port and outputting analog signals through Siemens' analog I/O. A complete programming program for the Siemens S7-200 is provided, along with points to note during the programming process, demonstrating practical value.

0 Introduction

      The Siemens S7-200 series PLC is the smallest PLC in the Siemens family. In addition to its general functions, it is distinguished from ordinary small PLCs by its powerful communication capabilities. It can easily complete complex control requirements through networks and distributed systems. The S7-200 series PLC CPU integrates one or more communication ports. The standard communication port is RS485. With the corresponding cables, a complex communication network with multiple communication functions can be formed [1] . The Super E40 series RTU is a new RTU product designed by Ankong Company based on many years of development and engineering experience. It can realize the acquisition of industrial field signals and the control of field equipment. Compared with commonly used programmable controllers (PLCs), it has better communication capabilities [2] .

This project utilizes the Super E40's A32-M1 CPU module, A32-L3 communication module, AC101 analog input module, AC133 digital output module, and AC141 pulse input module. Due to the lack of an analog output module, and the high cost of purchasing a separate AO module, this paper utilizes the Siemens S7-200's unique free-port communication mode to communicate with the safety control RTU. The safety control system converts the acquired analog signals and sends them to the Siemens S7-200 PLC. The Siemens then outputs current through the analog output port to drive the ball valve to the corresponding opening degree, demonstrating practicality.

1. System Overview

This project originates from our university's SRTP project (Undergraduate Scientific Research Training Program) and experimental technology project, and is titled "Process Control System Based on GPRS and RTU". This system is a process control system constructed based on PLC module technology and can be used for safety monitoring of natural gas and fluid pressure regulating stations and pipelines.

The platform consists of a single pipeline and is equipped with a pressure transmitter, an electric ball valve, a differential pressure gauge, a flow meter, a temperature transmitter, a water pump, and a water tank. The control cabinet is located separately and houses the Ancon Super E40 series RTU module system. The transmitter converts signals from pressure, temperature, and other sensors into standard electrical signals. These signals are then processed by the RTU and transmitted to the front-end processor via wired or wireless means for further data processing. The processed control signal is then sent to the electric ball valve for real-time operation. This project utilizes the Super E40's A32-M1 CPU module, A32-L3 communication module, AC101 analog input module, AC133 digital output module, AC141 pulse input module, and Siemens S7-200. The overall system block diagram is shown in Figure 1.

2 Siemens Communication Free Port Mode

The CPU's serial communication interface can be controlled by the user program. This operating mode is called free port mode. By using receive interrupt, transmit interrupt, character interrupt, transmit instruction (XMT) and receive instruction (RCV), free port communication can control the operating mode of the S7-200 CPU communication port. Using free port mode, user-defined communication protocols can be implemented to connect various intelligent devices [3] . Through SMB30, communication port 0 is allowed to use free port mode when the CPU is in RUN mode. When the CPU is in STOP mode, free port communication is stopped, and the communication port is forcibly converted to PPT protocol mode, thereby ensuring the programming software's programming and control functions for the PLC.

SMB30 is used to set parameters such as baud rate and parity for communication on port 0. This article sets up Siemens freeport communication with a baud rate of 9600, 8 data bits, 1 stop bit, no parity, and an A terminator. The main program is shown below:

Main program:

Network 1: // Set the control mode to free port communication mode and enable the character reception interrupt //
LD SM0.1 // PLC first scan

MOVB 16#09, SMB30 // Freeport communication, baud rate 9600, 8 data bits, 1 stop bit, no parity

MOVB 16#B0, SMB87 //Initialize RCV, enable RCV, include end-of-line character, check idle time

MOVB 16#0A, SMB89 // End-of-line character is A

MOVB 6, SMB94 // Maximum of 6 characters received at a time

ATCH INT_0:INT0, 23 // Receive completion interrupt 0

ATCH INT_1:INT1, 9 // Receive completion interrupt 1

ENI // Allows user interrupts

RCV VB199, 0 // The accept buffer pointer for port 0 points to VB199

Network 2:

LD SM0.1

CALL initialization:SBR1 //Call the initialization subroutine

Network 3:

LD SM0.0

MOVB 1, VB99

MOVW +1, VW100 // After receiving data, send 0 to the sending area.

Network 4:

LD SM0.5

XMT VB99, 0 // Send data 0 out from port 0

The Siemens analog output port outputs an analog signal and sends it to the electric ball valve, which then performs a real-time action. Controlling the valve opening becomes the key issue. The PID controller is the most widely used closed-loop controller, but it is mainly applicable when the controlled object has a large inertial lag. Given that this project does not have high requirements for lag and involves few analog inputs and outputs, this paper presents a simpler control method.

The ball valve opening is divided into 9 zones in 10° increments, each zone corresponding to a specific drive current. The data word ranges from 10000 to 50000 for the safety control RTU and from 0 to +32000 for the Siemens S7-200, as shown in Table 1. Data transmission between them is done via hexadecimal. Siemens receives the data in hexadecimal and stores it in a designated cell. For example, the safety control RTU data word 50000, converted to hexadecimal, is C350. Storing the two bytes in the designated Siemens cells results in a problem where the data exceeds the decimal range during conversion. Therefore, a method is used to send only the first byte to Siemens. For example, with 50000, only C3 is sent to Siemens, converting it to the corresponding decimal number 195, which makes processing easier.

Ball valve opening

Required current

Security control RTU data words

Siemens Data Word

Hexadecimal numbers corresponding to security control RTU data words

The decimal number corresponding to the first byte sent to Siemens

Region x

4mA

10000

6400

16# 2710

39

0≤x≤39

10°

6mA

15000

9600

16# 3A98

58

39 < x < 58

20°

8mA

20000

12800

16# 4E20

78

58≤x<78

30°

10mA

25000

16000

16# 61A8

97

78≤x<97

40°

12mA

30000

19200

16# 7530

117

97≤x<117

50°

14mA

35000

22400

16# 88B8

136

117≤x<136

60°

16mA

40000

25600

16# 9C40

156

136≤x<156

70°

18mA

45000

28800

16# AFC8

175

156≤x<175

90°

20mA

50000

32000

16# C350

195

175≤x≤195

Table 1 Ball valve opening range

The subroutine for adjusting the ball valve opening and the initialization subroutine are shown below.

subroutine for adjusting ball valve opening:

Network 1:

LD SM0.0

BTI VB200, VW200   // Convert the received byte data into words  

Network 2: //Partition//

LD SM0.0

MOVW +39, VW0

MOVW +58, VW2

MOVW +78, VW4

MOVW +97, VW6

MOVW +117, VW8

MOVW +136, VW10

MOVW +156, VW12

MOVW +175, VW14

MOVW +195, VW16

Network 3: // Determine if it is in the region 175≤x≤195. If so, output the corresponding current; otherwise, execute the following program.

sequence//

LD SM0.0

LDW>= VW200, VW14

AW <= VW200, VW16

MOVW +32000, AQW0

ENI

Network 4-Network 11: Determine whether the region is within the range of 156≤x<175, 136≤x<156, 117≤x<136, 97≤x<117, 78≤x<97, 58≤x<78, 39<x<58, 0≤x≤39. The procedure is the same as that for Network 3.

Initialization subroutine:

Network 1: // When Siemens is in RUN mode, VW200 is 0, and the output current is 4mA. //

LD SM0.1

MOVW +0, VW200

MOVW +6400, AQW0

ENI


The interrupt routines for receive completion interrupt 0 and receive completion interrupt 1 are as follows:


Receive complete interrupt 0 : INT0

Network 1:

LDB= SMB86, 16#20 //SMB86 equals 16#20, indicating that the PLC has received the closing symbol.

S Q1.0, 1 // After receiving the signal, set Q1.0 to 1, and the indicator light will turn on.

CALL Adjust Ball Valve Opening Subroutine: SBR0

CRETI

NOT // Otherwise, set Q1.0 to 0 and turn off the light.

R Q1.0, 1

RCV VB199, 0

Receive complete interrupt 1 : INT1

INT1:

Network 1:

LD SM0.0

RCV VB199, 0 // Receive data

3. Program Debugging

PLC serial communication debugging software was used during the programming process; this software can be downloaded online. Before communicating with the security control RTU, the Siemens S7-200 was first connected to a PC to verify the program's correctness before debugging communication with the security control RTU. Problems encountered and solutions were found during the debugging of communication between the Siemens S7-200 and the PC.

① The program crashes, meaning that when communicating with a PC, using PLC serial communication debugging software to send data to the PLC, the PLC will encounter a communication error after receiving the first character when sending data continuously. The main reason for the program crashing is a problem with the program structure. The problem can be solved by simplifying the program structure to make it more structured.

② The baud rate, data bits, parity bits, and stop bits of the Siemens S7-200 and the security control RTU are inconsistent. If they are not completely consistent, communication is not possible.

4. Summary  

This article presents a complete communication program for Siemens S7-200 to communicate with other devices using free ports. The proposed ball valve zone division method is innovative and can be applied to many fields. It also provides solutions to problems encountered during the programming process, making it highly practical and applicable to real-world projects.

References:

[1] Zhang Weidi, Zhou Zekui, Yang Liming, Zhang Guangxin. Realizing Information Transmission between PLC and Remote Data Terminal using Free Communication Port Mode [J]. Mechanical and Electrical Engineering, 2002, Vol. 19, No. 6

[2] Super E40 Series RTU User Manual

[3] Liao Changchu. PLC Programming and Application (Second Edition) [M]. Beijing: Machinery Industry Press, 2005.

Read next

CATDOLL 148CM Christina Silicone Doll

Height: 148 Silicone Weight: 33kg Shoulder Width: 34cm Bust/Waist/Hip: 70/58/82cm Oral Depth: N/A Vaginal Depth: 3-15cm...

Articles 2026-02-22