# Multiprotocol Communication Interface PMSM Control on Account of Industrial Configuration Software

Authors: Li-guo Zhang; Man-feng Dou
Journal: Journal of Electrical and Computer Engineering
 (2014)

---

## Abstract

The purpose is to achieve drive controller of PMSM connect with industrial control configuration software seamless and to meet the industrial configuration software in the demand for motor to realize intelligent control.  A software interface was designed and implemented about motor drive controller and the PC the industrial control configuration base on Modbus_RTU serial communication protocol of industrial control. One kind of design and implementation methods have been proposed in the communication interfaces for industrial applications scalable multiselectivity. Using the latest high-performance multiprotocol transceiver device pin programmable SP339 as the lower machine communications chip designed optional multi-interface hardware circuit with DSP TMS320F2812 as the processor. The interface program was studied with regard to C language software of lower machine and control configuration software of PC. Database creation, data acquisition, and animation links of PC configuration software are realized. Online debugging results meet the design requirements on account of PC control configuration software and the lower machine controller hardware and software.


---

## Body

## 1. Introduction

DSP with its powerful data processing capability becomes the first choice of motor control chip. If you want to reflect operating parameters and operating state of the motor intuitively, they must be achieved through feature-rich PC software. Currently, Labview virtual instrument is used as a PC software application research more widely. Its use RS232, RS485 serial communication user defined or Labview programming standard communication protocol from [1, 2] that is unable to adapt to industrial fields. In order to meet the needs of industrial serial communication field, the field of industrial design configuration software such as power control software, such as the hardware interface of group king software to meet to achieve control configuration software which controls the drive motor intelligent control.Literature [3] describes the Modbus communication protocol which utilizes RS232 communication and development of software dedicated only for communication design and does not have popularity. Literature [4] introduces an InTouch configuration software of RS232 communication, the use of the third-party software, and programming complexity. Multiprotocol communication interface chip [5] is used to meet the requirements of a variety of hardware design. This paper will introduce programmable multiple communication interfaces to meet the majority of industrial configuration software communication protocol ports which have Modbus the hardware and software design interface technology. A design project for the needs of a variety of interfaces is solved, given multi-interface implementations.


## 2. Scalability Strategy and Implementation of Communication

### 2.1. Scalability Strategy of Communication

The main difference among RS-232, RS-485, and RS-422 communication interfaces of the three is(1)
from the wires, RS232 is a three-wire, RS485 is a two-wire, and RS42 is a 4-wire;
(2)
from the transmission distance, RS232 can only transmit 15 meters; RS485 and RS422 can transmit 1200 meters in 19 kpbs;
(3)
on the rate, RS232 is full-duplex transmission, RS485 is half-duplex transmission, RS422 is full duplex transmission;
(4)
from the protocol layer, RS232 supports only point-to-point communication (1 : 1); RS485 and RS422 communications support bus in the form (1 : N).The above distinction formulated the following scenarios.(1)
RS232 interface is for close experimental communication; RS485/RS422 is suitable for practical engineering application of communication. Select the communication interface according to need.
(2)
As optional communication interface design, design of the hardware is provided. Single-chip multi-hardware [6–9] choices cannot only meet the design requirements but also reduce the burden of hardware design.
(3)
Hardware interfaces in the form of work are selected by software programming. Software design through the interface determines a corresponding program execution.


### 2.2. Hardware Implementation

Communications chip of motor control board using Exar Corporation latest single-chip SP339 with RS-232/RS-485/RS-422 multiprotocol serial transceiver. When the RS-232 and RS-485/422 protocols are shared between a connector, in order to be able to communicate properly, RS-232, RS-485 termination, and biasing resistors must be disconnected. SP339 integrated termination resistors and control switches, allow the system to enable or disable the termination resistor processor through a single pin. Simplifying the circuit design reduces costs. SP339 also bus pins with ±20 V fault tolerance capabilities that allow withstanding direct short circuit or signal voltage within this range is not compromised. The high speed drivers operate up to 20 Mbps in RS-485/422 modes, and up to 1 Mbps in RS-232 mode. All drivers can be limited to 250 kbps in any mode to minimize electromagnetic interference (EMI). On-board charge pumps only four external capacitors from a single 3.3 V or 5 V power supply needed to produce RS-232 bipolar voltage level and does not require any inductors or magnetic components.The communication system has RS-232 interface and RS-485/422 interfaces. In the past, hardware design using multi-chip ASIC and the control circuit to complete, resulting in complex structure and poor stability. Using the SP339 and supplemented by small amounts of other circuit chip and simply through software programming to control the corresponding pin can be easily implemented through RS-232 and RS-485/422 interface combinations. The communication interface based DSPTMS320F2812 processor program is shown in Figure1; SP339 has multiple ports to connect with the DSP that can realize data transmission and control. Use of this circuit may control SP339’s SLEW, DIR1, MODE0, MODE1, TERM, and ENABLE programmable pin by software that enables RS-232 or RS-485/422 asynchronous communications.Figure 1
The circuit of communication interface.


### 2.3. Modbus_RTU Serial Communication Protocol Design about Motor Drive Control [10]

Serial communication only defines the communication hardware specification; no specific software communication protocol is defined as so-called free agreement. Therefore, serial communication is often combined with software communication protocol. Modbus protocol supports traditional, RS-232, RS-485/422, and Ethernet devices; this agreement is an existing industrial control configuration software used by communications protocols.This design uses RTU (Remote Terminal Unit) protocol of the Modbus communication protocol. RTU communication method uses 8-bit binary data transfer and CRC Cyclic redundancy check as data validation, so communication is faster. The data structures and data transmission of the interface technology communication protocol use the following specifications.(1)
Data transfer format: asynchronous transmission, a start bit, 8 data bits, 2 stop bits, no parity, total 11; default baud rate of data transfer rate 9600 bps. Slave supports host machine modified transmission rate.
(2)
Packet format of data transceiver functions is shown in Table1.Table 1
The request to read or write a data message format of  PC.
Sending content
Byte count
Transmitted information
Start frame
4
Pause time
Address code
1
XX
Function code
1
XX
Date area
N
DATA1…DATAN
CRC code
2
XXXX
End frame
4
Pause timeThis design uses a set of register data read function code 03H and write function code 10H. Master and slave communication process to obtain data from master to slave, including analog data, digital data, and system parameters, are collected from the instrument of slave. Address written communication baud rate, switching output, analog output, and system parameters of slave are saved with the same function code. Each register corresponds to specific ports and each controlling the specified device, which can improve the reliability of control.


### 2.4. Software in C Language

DSP software use C language programming. Data transfer uses RS232 or RS485 line real-time communication. As the DSP internal programming approach is online waiting interrupts. The program of protocol and interface is completed in the main program. Next comes the holding register read and write subroutines and interrupt communication program flowchart.The Figure2 shows that lower computer literacy holds register for the PC to complete the execution of a request and response, respectively, through 03H and 10H function subroutines. They have a common implementation structure. Implementation structure helps simplify common programming structure, improve program scalability, and facilitate program implementation and modification.Figure 2
The subroutine structure diagram.RS232 supports only point-to-point communication; RS485 supports bus communication form. Therefore, two interfaces for data transmission control subroutine differ in the data reception and data transmission.In addition, as shown in Figure3 in order to improve the readability and reliability of operation, the functions of interrupt program use subroutine. Subroutine function code includes judgments, data transceiver, 10 mS timer soft reset interrupt (timeout), parity, data illegal judgment, register read and write, and function code that does not recognize the answer.Figure 3
Flow chart of read and write holding register communication interruption.


## 2.1. Scalability Strategy of Communication

The main difference among RS-232, RS-485, and RS-422 communication interfaces of the three is(1)
from the wires, RS232 is a three-wire, RS485 is a two-wire, and RS42 is a 4-wire;
(2)
from the transmission distance, RS232 can only transmit 15 meters; RS485 and RS422 can transmit 1200 meters in 19 kpbs;
(3)
on the rate, RS232 is full-duplex transmission, RS485 is half-duplex transmission, RS422 is full duplex transmission;
(4)
from the protocol layer, RS232 supports only point-to-point communication (1 : 1); RS485 and RS422 communications support bus in the form (1 : N).The above distinction formulated the following scenarios.(1)
RS232 interface is for close experimental communication; RS485/RS422 is suitable for practical engineering application of communication. Select the communication interface according to need.
(2)
As optional communication interface design, design of the hardware is provided. Single-chip multi-hardware [6–9] choices cannot only meet the design requirements but also reduce the burden of hardware design.
(3)
Hardware interfaces in the form of work are selected by software programming. Software design through the interface determines a corresponding program execution.


## 2.2. Hardware Implementation

Communications chip of motor control board using Exar Corporation latest single-chip SP339 with RS-232/RS-485/RS-422 multiprotocol serial transceiver. When the RS-232 and RS-485/422 protocols are shared between a connector, in order to be able to communicate properly, RS-232, RS-485 termination, and biasing resistors must be disconnected. SP339 integrated termination resistors and control switches, allow the system to enable or disable the termination resistor processor through a single pin. Simplifying the circuit design reduces costs. SP339 also bus pins with ±20 V fault tolerance capabilities that allow withstanding direct short circuit or signal voltage within this range is not compromised. The high speed drivers operate up to 20 Mbps in RS-485/422 modes, and up to 1 Mbps in RS-232 mode. All drivers can be limited to 250 kbps in any mode to minimize electromagnetic interference (EMI). On-board charge pumps only four external capacitors from a single 3.3 V or 5 V power supply needed to produce RS-232 bipolar voltage level and does not require any inductors or magnetic components.The communication system has RS-232 interface and RS-485/422 interfaces. In the past, hardware design using multi-chip ASIC and the control circuit to complete, resulting in complex structure and poor stability. Using the SP339 and supplemented by small amounts of other circuit chip and simply through software programming to control the corresponding pin can be easily implemented through RS-232 and RS-485/422 interface combinations. The communication interface based DSPTMS320F2812 processor program is shown in Figure1; SP339 has multiple ports to connect with the DSP that can realize data transmission and control. Use of this circuit may control SP339’s SLEW, DIR1, MODE0, MODE1, TERM, and ENABLE programmable pin by software that enables RS-232 or RS-485/422 asynchronous communications.Figure 1
The circuit of communication interface.


## 2.3. Modbus_RTU Serial Communication Protocol Design about Motor Drive Control [10]

Serial communication only defines the communication hardware specification; no specific software communication protocol is defined as so-called free agreement. Therefore, serial communication is often combined with software communication protocol. Modbus protocol supports traditional, RS-232, RS-485/422, and Ethernet devices; this agreement is an existing industrial control configuration software used by communications protocols.This design uses RTU (Remote Terminal Unit) protocol of the Modbus communication protocol. RTU communication method uses 8-bit binary data transfer and CRC Cyclic redundancy check as data validation, so communication is faster. The data structures and data transmission of the interface technology communication protocol use the following specifications.(1)
Data transfer format: asynchronous transmission, a start bit, 8 data bits, 2 stop bits, no parity, total 11; default baud rate of data transfer rate 9600 bps. Slave supports host machine modified transmission rate.
(2)
Packet format of data transceiver functions is shown in Table1.Table 1
The request to read or write a data message format of  PC.
Sending content
Byte count
Transmitted information
Start frame
4
Pause time
Address code
1
XX
Function code
1
XX
Date area
N
DATA1…DATAN
CRC code
2
XXXX
End frame
4
Pause timeThis design uses a set of register data read function code 03H and write function code 10H. Master and slave communication process to obtain data from master to slave, including analog data, digital data, and system parameters, are collected from the instrument of slave. Address written communication baud rate, switching output, analog output, and system parameters of slave are saved with the same function code. Each register corresponds to specific ports and each controlling the specified device, which can improve the reliability of control.


## 2.4. Software in C Language

DSP software use C language programming. Data transfer uses RS232 or RS485 line real-time communication. As the DSP internal programming approach is online waiting interrupts. The program of protocol and interface is completed in the main program. Next comes the holding register read and write subroutines and interrupt communication program flowchart.The Figure2 shows that lower computer literacy holds register for the PC to complete the execution of a request and response, respectively, through 03H and 10H function subroutines. They have a common implementation structure. Implementation structure helps simplify common programming structure, improve program scalability, and facilitate program implementation and modification.Figure 2
The subroutine structure diagram.RS232 supports only point-to-point communication; RS485 supports bus communication form. Therefore, two interfaces for data transmission control subroutine differ in the data reception and data transmission.In addition, as shown in Figure3 in order to improve the readability and reliability of operation, the functions of interrupt program use subroutine. Subroutine function code includes judgments, data transceiver, 10 mS timer soft reset interrupt (timeout), parity, data illegal judgment, register read and write, and function code that does not recognize the answer.Figure 3
Flow chart of read and write holding register communication interruption.


## 3. Industrial Control Configuration Software (ICCS) [11, 12] Interface

ICCS is special software to handle data acquisition and process control. Its outstanding feature is real-time multitasking; you can achieve data acquisition and output, data processing and algorithms, graphical display and interactive, real-time data storage, retrieve management, and real-time communications such as multitasking.The ICCS selection Beijing Sunway force control configuration software is the test software. Software enables remote control operation, remote monitoring of the motor operating status and performance, timely data collection and analysis of data, generating dynamic data visualization, and generating a valid database.


### 3.1. The Establishment of a Database [13]

Define a series of data is used to reflect the software to monitor various parameters of the controlled motor; for example, real-time temperature control panel, bus current, motor temperature, motor speed, and other data collected by the control panel but also includes some necessary intermediate variables and indirect variables. Database is shown in Figure4.Figure 4
Variable manager window.


### 3.2. Movie Connection

Through the establishment of data in the database connection relationship with the graphics object, to make the picture vivid visual parameters reflect changes. You can set the over current alarm limit, if more than 30 A alarm.codes are shown in Algorithm1 such as real-time monitoring bus current control panel.Algorithm 1
IF MD.PV> = 30 THEN
FLAG_I = 1;/*Set intermediate variables, alarm flags*/
ELSE
FLAG_I = 0;/*When the current is less than 30 A, the alarm flag is reset*/
EDIF
IF FLAG_I = 1 THEN
MSGBOX (“bus current over current alarm”);
/*Computer display a dialog box, “bus current over current alarm”*/
BEEF (1);/*overvoltage, the computer sends the alarm sounds* Type I/
FLAG_I = 0;/*alarm flag bit is reset*/
EDIF


### 3.3. I/O Connections

Force control configuration software for the use of different communication protocols for I/O devices can provide targeted I/O drivers. Real-time database performs data acquisition and command control from I/O devices with the help of the I/O driver. As described in this paper belong to Modbus RTU communication protocol for industrial control configuration software common control communication protocol can be set via the configuration software is very easy to achieve I/O connections.To achieve I/O connections of three hardware aspect is essential, PC serial port, serial cable (if the next bit machine as RS485 interface, where the need RS232 to RS485 interface), and lower machine interface. Three hardware conditions are met to ensure the premise in a certain lower machine address. Software setup is complete I/O connections through the configuration.


## 3.1. The Establishment of a Database [13]

Define a series of data is used to reflect the software to monitor various parameters of the controlled motor; for example, real-time temperature control panel, bus current, motor temperature, motor speed, and other data collected by the control panel but also includes some necessary intermediate variables and indirect variables. Database is shown in Figure4.Figure 4
Variable manager window.


## 3.2. Movie Connection

Through the establishment of data in the database connection relationship with the graphics object, to make the picture vivid visual parameters reflect changes. You can set the over current alarm limit, if more than 30 A alarm.codes are shown in Algorithm1 such as real-time monitoring bus current control panel.Algorithm 1
IF MD.PV> = 30 THEN
FLAG_I = 1;/*Set intermediate variables, alarm flags*/
ELSE
FLAG_I = 0;/*When the current is less than 30 A, the alarm flag is reset*/
EDIF
IF FLAG_I = 1 THEN
MSGBOX (“bus current over current alarm”);
/*Computer display a dialog box, “bus current over current alarm”*/
BEEF (1);/*overvoltage, the computer sends the alarm sounds* Type I/
FLAG_I = 0;/*alarm flag bit is reset*/
EDIF


## 3.3. I/O Connections

Force control configuration software for the use of different communication protocols for I/O devices can provide targeted I/O drivers. Real-time database performs data acquisition and command control from I/O devices with the help of the I/O driver. As described in this paper belong to Modbus RTU communication protocol for industrial control configuration software common control communication protocol can be set via the configuration software is very easy to achieve I/O connections.To achieve I/O connections of three hardware aspect is essential, PC serial port, serial cable (if the next bit machine as RS485 interface, where the need RS232 to RS485 interface), and lower machine interface. Three hardware conditions are met to ensure the premise in a certain lower machine address. Software setup is complete I/O connections through the configuration.


## 4. ICCS Combines Hardware Platform Debugging Results

### 4.1. ICCS and Motor Drive Control Seamless Connection

ICCS and motor drive control are met seamlessly through the following conditions.(1)
Motor drive control communications hardware interface circuit; RS232 and RS485 communication can be realized.
(2)
With Provide the appropriate interface and software programming based Modbus_RTU communication protocol.
(3)
It requires a conversion device that can achive RS232/RS485 and PC connection [14].
(4)
ICCS PC programming in addition to the settings of low machine.ICCS combines hardware platform debugging using the following measures. The lower machine controller communications hardware circuit connects with the PC communication interface hardware through the hardware adapter interfaces which carry lower computer software and PC software joint commissioning. Lower machine measure and record data in real time. Host request to send real-time data acquisition and through the control configuration software to analyze data in real time and thus depict the curve. Shown in Figure5 is the PC Control Software collected data and real-time display.Figure 5
The interface of industrial control software.


### 4.2. ICCS for Intelligent Motor Control Experiment

ICCS for intelligent motor control is mainly reflected in; you can start and stop the motor, remote control, motor control parameter adjustment, electrical fault alarm, and motor run history parameter query.Test conditions; the use of power control ICCS design PC control interface. Choose to use the PC and the control panel 485. Motor controller using DSP (MS320F2812) to control the core, IGBT three-phase full-bridge inverter drive motor. Motor with 18 kW PMSM.Commissioning projects and results are as follows.(1)
Motor start or stop and ICCS to send control commands to control the motor via the motor controller can start and stop normally.
(2)
ICCS to set the motor speed and to communicate motor controller. The controller controls the motor according to the set speed operation and motor speed to meet the preset value measured.
(3)
ICCS set the motor fault alarm limit and the data transmitted to the motor controller. The ICCS generates an alarm when the motor fault. The test set motor overheating alarm limit. When generating hardware alarm information at the same time the alarm data transmit to the ICCS.
(4)
ICCS establish a database. You can transfer the data of lower machine to the PC real-time storage and it can be viewed at any time through ICCS.ICCS project tasks according to changing PC programming and interface settings, to complete real-time control of the motor and real-time data acquisition and to achieve real-time monitoring of the motor.


## 4.1. ICCS and Motor Drive Control Seamless Connection

ICCS and motor drive control are met seamlessly through the following conditions.(1)
Motor drive control communications hardware interface circuit; RS232 and RS485 communication can be realized.
(2)
With Provide the appropriate interface and software programming based Modbus_RTU communication protocol.
(3)
It requires a conversion device that can achive RS232/RS485 and PC connection [14].
(4)
ICCS PC programming in addition to the settings of low machine.ICCS combines hardware platform debugging using the following measures. The lower machine controller communications hardware circuit connects with the PC communication interface hardware through the hardware adapter interfaces which carry lower computer software and PC software joint commissioning. Lower machine measure and record data in real time. Host request to send real-time data acquisition and through the control configuration software to analyze data in real time and thus depict the curve. Shown in Figure5 is the PC Control Software collected data and real-time display.Figure 5
The interface of industrial control software.


## 4.2. ICCS for Intelligent Motor Control Experiment

ICCS for intelligent motor control is mainly reflected in; you can start and stop the motor, remote control, motor control parameter adjustment, electrical fault alarm, and motor run history parameter query.Test conditions; the use of power control ICCS design PC control interface. Choose to use the PC and the control panel 485. Motor controller using DSP (MS320F2812) to control the core, IGBT three-phase full-bridge inverter drive motor. Motor with 18 kW PMSM.Commissioning projects and results are as follows.(1)
Motor start or stop and ICCS to send control commands to control the motor via the motor controller can start and stop normally.
(2)
ICCS to set the motor speed and to communicate motor controller. The controller controls the motor according to the set speed operation and motor speed to meet the preset value measured.
(3)
ICCS set the motor fault alarm limit and the data transmitted to the motor controller. The ICCS generates an alarm when the motor fault. The test set motor overheating alarm limit. When generating hardware alarm information at the same time the alarm data transmit to the ICCS.
(4)
ICCS establish a database. You can transfer the data of lower machine to the PC real-time storage and it can be viewed at any time through ICCS.ICCS project tasks according to changing PC programming and interface settings, to complete real-time control of the motor and real-time data acquisition and to achieve real-time monitoring of the motor.


## 5. Conclusion

This paper designs the communication circuit of the motor controller and software programming, realized the interface technology and PC control software. Designing and debuging the results obtained the following conclusions.(1)
DSP TMS320F2812 processor realizes the Modbus_RTU communication protocol by software. Software is able to adapt to the field of industrial configuration software which uses this protocol for communication.
(2)
Hardware communication scalability provided strong foundation for remote communication which includes network communication.
(3)
The perfect PC force control software and slave software are designed for the use of other configuration software to provide a reference.



---

*Source: 651216-2014-03-10.xml*