PLC_Siemens reads Modbus protocol

PLC_Siemens reads Modbus protocol

Applicable Model






Series Article Directory





Preparation tool

Video tutorial

Background introduction:

Recently, due to the needs of the project, it is necessary to use PLC to obtain the tilt angle of the equipment and send out an alarm. After careful research and investigation, the PLC selected domestic Siemens PLC, which is more cost-effective. There are many sensors available in the market, but there are not many manufacturers that support the Modbus protocol of PLC, and I use it in an industrial environment, which is good for stability and small temperature drift. After a comprehensive comparison, we chose the HWT905 of WITMOTION, which uses an industrial-grade sensor chip with temperature compensation. The magnetic field chip uses the highest-precision PNI magnetic field sensor on the market, which has excellent anti-interference and stability. The Kalman filter algorithm is used to fuse information from the accelerometer, gyroscope, and magnetic field to obtain more accurate data. The main parameter performance of the sensor is as follows

  1. Voltage: 5V~36V

  2. Current: <40mA

  3. Volume: 55mm X 36.8mm X 24mm

  4. Measurement dimensions: acceleration: 3D, angular velocity: 3D, magnetic field: 3D, angle: 3D

  5. Range: acceleration: ±6g, angular velocity: ±2000°/s, angle ±180°.

  6. Stability: acceleration: 0.01g, angular velocity 0.05°/s.

  7. Measurement error: X Y axis 0.05°, Z axis 1° (the magnetic field is well calibrated and not disturbed by the magnetic field).

  8. Data output content: time, acceleration, angular velocity, angle, magnetic field.

  9. The data output frequency is 0.2Hz~200Hz.

  10. Data interface: serial port (485 level, baud rate supports 4800, 9600 (default), 19200, 38400, 57600, 115200, 230400, 460800, 921600).

Note: The software STEP-7MicroWIN V4.0 SP9 needs to be installed on the xp and win7 systems, and it will not be installed normally on win10, and the software will be incomplete.


  1. Connect the Siemens plc download cable to the computer, connect the power supply, and turn the plc switch to stop.

  2. Open the software STEP-7MicroWIN V4.0 SP9, and click Communication.

  3. Click to set PG/PC interface

  4. In PC/PPI cable (PPI), click "Properties".

  5. Select the correct COM serial port and click "OK".

  6. Double-click to refresh.

  7. After searching for PLC, you can click "Cancel" and then click "Confirm".

  8. Install the mudbus instruction library. After decompression, click "setup" to install it. The instruction library can be downloaded in the link. [MISSING IMAGE: , ]

  9. Write a program, the program can be downloaded in the link.

  10. After using the mudbus command, expand the "library" in the program block, right-click "library", click "library storage area", click "suggested address", and then click "confirm".

  11. Compile the program, click "Compile All", and you can see that there are no errors.

  12. Click "Download" in the file.

  13. Select the content to be downloaded, and then click "Download".

  14. Click "Run" in the box to remotely control the operation of the PLC. [MISSING IMAGE: , ]

  15. Click the monitor button in the box to monitor the running status of the program. [MISSING IMAGE: , ]

  16. Click "Status Table" to monitor and view the data in the corresponding storage area. Double-click to open the trend data properties and set the monitoring content. [MISSING IMAGE: , ]

Last updated