Simplifying Communication and Speed Control of PLC and Inverter

Simplifying Communication and Speed Control of PLC and Inverter

PLC and Inverter Communication: Writing PLC for Simpler Speed Control

Simplifying Communication and Speed Control of PLC and Inverter

Using PLC to control the inverter, manage speed adjustment and start/stop, and eliminate a bunch of wiring through communication. Today, I will guide you through this practical project!

Simplifying Communication and Speed Control of PLC and Inverter

Project Requirements and Function Description

Simplifying Communication and Speed Control of PLC and Inverter

The requirements for this PLC and inverter communication project are:

  1. Control the inverter using PLC via MODBUS RTU protocol to achieve motor start/stop and frequency adjustment.
  2. Support manual mode, allowing operators to directly input frequency or start/stop signals on the HMI.
  3. Implement communication status detection to avoid communication failures that prevent the inverter from operating normally.
  4. Display the current frequency and operating status of the motor in real-time on the HMI for clear visibility to the operator.
  5. The program must be stable to prevent abnormal frequency changes due to signal loss or misoperation.

Simplifying Communication and Speed Control of PLC and Inverter

Breakdown of Implementation Logic

Simplifying Communication and Speed Control of PLC and Inverter

The logic of this system can be divided into the following parts:

  • Communication Initialization Logic: Establish communication between PLC and inverter, setting related parameters such as baud rate, address, etc.
  • Frequency Adjustment Logic: Modify the operating frequency of the inverter through PLC to control motor speed.
  • Start/Stop Control Logic: Control the start and stop of the inverter through communication, replacing traditional wired control.
  • Communication Status Detection: Monitor the communication status and immediately alarm and stop the inverter when a fault is detected.
  • Status Display Logic: Real-time display of the current frequency, motor status, and communication status of the inverter.

Simplifying Communication and Speed Control of PLC and Inverter

Code Implementation

Simplifying Communication and Speed Control of PLC and Inverter

Below is the ladder diagram code for implementing PLC and inverter communication using Siemens S7-1200, featuring simple operation and clear logic.

Simplifying Communication and Speed Control of PLC and Inverter

1. Input/Output Allocation Table

Simplifying Communication and Speed Control of PLC and Inverter

First, organize resource allocation to make programming more intuitive.

Name Address Description
Manual Mode Button I0.0 Switch to manual mode
Start Button I0.1 Motor start signal
Stop Button I0.2 Motor stop signal
Communication Status Alarm Output Q0.0 Trigger alarm on communication fault
Current Frequency Display DB1.DBD0 HMI displays motor running frequency
Current Status Display DB1.DBX0.0 HMI displays motor running status

Simplifying Communication and Speed Control of PLC and Inverter

2. Communication Initialization Logic

Simplifying Communication and Speed Control of PLC and Inverter

Set the communication parameters between the PLC and inverter using the MODBUS RTU protocol, such as baud rate and station number.

| MODBUS_INIT
|---| |-------( )---|   // Initialize MODBUS communication module  

Once initialized, data can be sent and received using MODBUS function codes.

Simplifying Communication and Speed Control of PLC and Inverter

3. Frequency Adjustment Logic

Simplifying Communication and Speed Control of PLC and Inverter

Adjust the operating frequency of the motor dynamically by writing to the frequency register of the inverter.

| I0.0       DB1.DBD4
|---| |-------( )---|   // In manual mode, frequency set value is written from HMI to data block  

| DB1.DBD4   MODBUS_WRITE
|---|MOV|------( )---|   // Write the frequency set value to the inverter register via MODBUS  

Simplifying Communication and Speed Control of PLC and Inverter

4. Start/Stop Control Logic

Simplifying Communication and Speed Control of PLC and Inverter

Write to the control register of the inverter to start and stop the motor.

| I0.1       DB1.DBX0.1
|---| |-------( )---|   // Write start signal to data block  

| I0.2       DB1.DBX0.2
|---| |-------( )---|   // Write stop signal to data block  

| DB1.DBX0.1  MODBUS_WRITE
|---|MOV|------( )---|   // Write start signal to the inverter register via MODBUS  

| DB1.DBX0.2  MODBUS_WRITE
|---|MOV|------( )---|   // Write stop signal to the inverter register via MODBUS  

Simplifying Communication and Speed Control of PLC and Inverter

5. Communication Status Detection

Simplifying Communication and Speed Control of PLC and Inverter

Use the communication status detection function of the PLC to determine if communication is normal, triggering an alarm and stopping the motor operation in case of an anomaly.

| NOT MODBUS_COMM_STATUS  Q0.0
|---| |-------( )---|   // Trigger alarm signal on communication fault  

| NOT MODBUS_COMM_STATUS  DB1.DBX0.2
|---| |-------( )---|   // Write stop signal on communication fault  

Simplifying Communication and Speed Control of PLC and Inverter

6. Status Display Logic

Simplifying Communication and Speed Control of PLC and Inverter

Write the motor running status, current frequency, and communication status to the HMI so the operator can monitor in real-time.

| MODBUS_READ  DB1.DBD0
|---|MOV|------( )---|   // Read the current frequency from the inverter and write to data block  

| MODBUS_COMM_STATUS  DB1.DBX0.3
|---| |-------( )---|   // Write communication status to HMI variable  

| DB1.DBD0   HMI_DISPLAY
|---|MOV|------( )---|   // Write current frequency to HMI display  

Simplifying Communication and Speed Control of PLC and Inverter

Optimization and Common Issues

Simplifying Communication and Speed Control of PLC and Inverter

  1. Communication Interruption Issue: MODBUS communication may be interrupted due to interference. It is recommended to add reconnection logic and periodically send heartbeat packets to check communication status.
  2. Frequency Misoperation Issue: When inputting frequency values in manual mode, it is advisable to set an input range, such as 0 to 50Hz, to prevent misoperation that could lead to inverter alarms.
  3. Register Address Error Issue: The register addresses of the inverter must correspond to the PLC program; always refer to the inverter manual when programming.
  4. Communication Delay Issue: MODBUS communication has a certain delay; efficiency can be improved by optimizing the scanning cycle or batch reading and writing registers.

Simplifying Communication and Speed Control of PLC and Inverter

Complete Code Framework

Simplifying Communication and Speed Control of PLC and Inverter

Below is the complete ladder diagram code framework:

| MODBUS_INIT                                // Communication initialization
|---| |-------( )---|  

| I0.0       DB1.DBD4                       // Manual mode frequency setting
|---| |-------( )---|  

| DB1.DBD4   MODBUS_WRITE                   // Write frequency to inverter
|---|MOV|------( )---|  

| I0.1       DB1.DBX0.1                    // Start signal
|---| |-------( )---|  

| I0.2       DB1.DBX0.2                    // Stop signal
|---| |-------( )---|  

| DB1.DBX0.1  MODBUS_WRITE                 // Write start signal to inverter register
|---|MOV|------( )---|  

| DB1.DBX0.2  MODBUS_WRITE                 // Write stop signal to inverter register
|---|MOV|------( )---|  

| NOT MODBUS_COMM_STATUS  Q0.0             // Communication fault alarm
|---| |-------( )---|  

| MODBUS_READ  DB1.DBD0                    // Read current frequency from inverter
|---|MOV|------( )---|  

| DB1.DBD0   HMI_DISPLAY                   // Write current frequency to HMI
|---|MOV|------( )---|  

Simplifying Communication and Speed Control of PLC and Inverter

Conclusion

Simplifying Communication and Speed Control of PLC and Inverter

The key to PLC controlling the inverter is the communication logic; get the connection right, and it will be stable! If you have any questions, feel free to leave a message, and we will tackle it together!

Leave a Comment