Share this

Communication Design between Smart Meters Based on MSP430 and KingSCADA

2026-04-06 08:09:34 · · #1

Abstract: This paper presents a method for direct communication between KingSCADA and multiple MSP430 microcontrollers using the Adam module protocol. This method is simple, economical, and provides stable data transmission, and has been successfully applied in a practical monitoring system design.

Keywords: Smart meter; KingSCADA; Adam module; Multi-machine communication

1 Introduction

At present, the communication between KingSCADA and the microcontroller is mostly carried out through dynamic data exchange or by developing a communication driver [1]. Dynamic data exchange (DDE) is a complete communication protocol on the Windows platform. Through DDE, applications can exchange data and send instructions to each other. However, using DDE will bring some additional overhead, such as reducing the real-time performance of the system and increasing the unreliability of the system. In particular, it is not very stable when transmitting multiple parameters, and data loss is easy to occur. Developing a communication driver is also difficult and has a long development cycle. Recently, in the design of the coal conveyor belt monitoring system of Jiujiang Petrochemical, the intelligent instrument based on the MSP430 microcontroller is used as the lower machine, and the industrial control computer of Advantech is used as the upper machine. The ADAM-5000 protocol is used to realize the real-time acquisition, processing and display of data. 2 System structure The overall structure of the coal conveyor belt monitoring system is shown in Figure 1. Various sensors on-site transmit the measured voltage, current, and speed signals to the host computer via a self-made intelligent instrument. The real-time display and monitoring of the belt's operation status is then displayed on the configuration interface. External status input is achieved by the intelligent instrument detecting the status of the motor contactor's auxiliary contacts. The system's alarm protection only activates when the signal is closed; otherwise, if an open circuit signal is detected, the sampled value exceeds the range without triggering an alarm, and the relay does not operate. Fault output refers to the intelligent instrument sending a pulse signal to the PLC when a fault occurs, such as motor overcurrent, belt blockage, belt stoppage, or pin breakage. This signal is then transmitted to the 1-15# traction motor contactor and alarm indicator light, thereby disconnecting the corresponding contactor, stopping the corresponding motor, and simultaneously issuing corresponding audible and visual alarm signals.

Figure 1. Overall structural block diagram of the coal conveyor belt monitoring system

3. Communication Implementation

3.1 Communication Interface

This system adopts the RS485 serial communication standard. RS485 uses differential transmission, which effectively improves common-mode interference immunity, with a maximum transmission rate of 10Mb/s and a maximum transmission distance of 1200m. It supports multiple connections with data communication devices. Due to its high transmission rate and long transmission distance, RS485 has become the common form of serial communication in industrial control systems. When using RS485 to achieve serial communication between the host computer and the slave computer, since the host computer usually only provides an RS232 serial interface, an RS232/RS485 communication interface is needed for conversion. In the monitoring system developed in this paper, a multi-serial port card is used to achieve this conversion.

3.2 Characteristics of MSP Serial Communication

The MSP430F149 has two serial communication modules: USART0 and USART1[2]. It has strong communication capabilities. The module can trigger an interrupt when sending and receiving each byte of data, thereby causing the CPU to exit the low-power mode. The send and receive interrupts are controlled by two independent interrupt control bits. Compared with traditional serial communication, the MSP430 microcontroller achieves high-speed communication with low clock frequency by: in addition to the frequency division factor, there is also a frequency division factor adjustment register. It can achieve different frequency division factors for each bit in each byte by using the frequency division factor plus adjustment method, thereby ensuring that the three clock states of each data bit are within the effective data range, and achieving a high communication baud rate at low clock frequency. The communication format of the slave address bit multi-machine mode is: start bit + data bit + address/data bit + stop bit. The slave determines whether the received data frame or address frame is a data frame through the address/data bit. When the received data is an address, the received byte is compared with the local address. If they are equal, it indicates that the master will communicate with the local machine and resets the URXWIE bit of the U0RCTL register. Upon receiving data, a receive interrupt will be triggered, and the received data will be stored in the receive buffer within the interrupt routine. If the received address does not match the local address, it indicates that subsequent data sent by the host is not addressed to the local machine. The URXWIE bit in register U0RCTL will be set, and subsequent data bytes received will not trigger an interrupt.

3.3 Communication Protocol

The ADAM5000/485 series adopts the EIA RS485 communication protocol, which follows the command/response communication method [3]. During the communication process, the master station maintains the initiative and establishes a communication connection by calling the sub-station. It controls the direction and content of data transmission by sending command frames to the sub-station. The sub-station can only respond to the master station's calls to itself and transmit data accordingly based on the content of the frame. The RS485 port of the ADAM module communicates with the computer in a serial asynchronous half-duplex mode and supports ASCII code transmission. The frame format of the AI ​​module in the ADAM-5000 series is shown in Table 1.

Table 1 ADAM-5017 Command Frame Format

The first byte of the command frame is the start character, which can be either $ or #. Commands starting with $ can retrieve version information, correct AI modules, etc.; those starting with # are used to read ADAM-5017 channel values, which is the command format we will be using; the address range is 00-FF; the slot number i ranges from 0-7; otherwise, when the delimiter is $, there are 9 formats, which will not be described here. When the delimiter is #, there are 2 formats: one is empty, in which the command content reads all channel values ​​of the i-th slot module; the other is channel value j, in which the command content reads the j-th channel value of the i-th slot module. The ADAM-5000 response frame format is shown in Table 2. For command frames with # as the delimiter, there are two response frame formats.

Table 2 ADAM-5017 Response Frame Format

The start character is >, which indicates that the command received by the module is valid. The following is the value of all channels or the value of a specific channel, depending on the command frame format. The start character is ?, which indicates that the command received by 5017 is invalid. The following address is the same as the address of the received command frame.

The coal conveyor belt monitoring system uses 1 start bit, 8 data bits, 1 end bit, 0 parity bits, and a baud rate of 9600bps. If the configuration king wants to obtain the data of 5017 (slot 1) with address 01 of ADAM-5000, it sends #01S1(cr) in the serial port debugging tool. The self-made intelligent instrument first judges the command sent by the serial port debugging tool. If the received command conforms to the ADAM5000/485 instruction set (such as #01S1(cr)), it returns according to the response format of the instruction set (such as: >+1.4567,+1.4852,+1.6661,+1.6321,+1.6459,+2.989,+1.7768,+1.1623(cr))[3][4]. 3.4 Communication Configuration of KingSCADA KingSCADA 6.51 is an intelligent software package that establishes the human-machine interface of industrial control objects on the host computer. It uses Windows NT4.0 (sp6)/Windows 2000/Windows XP Simplified Chinese version operating system as its operating platform, making full use of the features of Windows graphics, complete functions, good interface consistency, and easy learning and use[5]. KingSCADA regards each device that it communicates with as an external device. Currently, it can connect to hundreds of external devices such as PLC, intelligent instruments, intelligent modules, boards, and frequency converters. In order to realize communication with external devices, KingSCADA has built-in a large number of device drivers as communication interfaces between KingSCADA and external devices. During operation, KingSCADA can exchange data with external devices through the driver interface, including data acquisition and data sending commands. This system uses COM3 and COM4 ports to plug in multiple serial port cards. Among them, COM3 port is connected to instruments 1#-7#, and COM4 port is connected to instruments 8#-15#. A total of 105 I/O parameters are collected, transmitted, and displayed. In the KingSCADA project browser, click Device\COM3. In the right window, double-click New to bring up the Device Configuration Wizard. Set the Intelligent Module\Adam5000 Series\Adam5017\Serial and keep clicking Next. Name the logical device No. 1 Instrument AD Module 5017. Select COM3 port and configure the device address to 0011 (KingSCADA device address setting format is a four-digit integer, the first three digits are the network address of ADAM-5000, and the fourth digit is the slot number of the I/O module (range 0-7). For example, if the address is set to 0011, 001 is the network address of ADAM-5000, and 1 is the second slot number). Set the communication parameters to complete the device communication configuration. Similarly, the configuration of the other 14 devices can be completed. Set the communication parameters of COM3 and COM4 to 9600/8/1/No parity. In addition, the parameters of each I/O variable need to be set, as shown in Figure 2.

Figure 2. KingSCADA I/O Variable Definitions

3.5 Communication Software Design

To ensure reliable data transmission, the instrument's communication section adopts the protocol of Advantech's ADAM-5017 multi-channel A/D module, avoiding the need to develop a driver program between the host computer and the instrument, thus significantly shortening system development time. The MSP430 microcontroller generates an interrupt upon receiving or sending a character, completing communication via interrupt mode. The MSP430 microcontroller read/write program flowchart is shown in Figure 3.

Figure 3 Flowchart of Communication Software

4. Conclusion

This paper utilizes the ADAM-5000 module protocol to achieve serial communication between KingSCADA 6.51 and multiple MSP430 microcontrollers. This method demonstrates reliable data transmission, particularly when acquiring and displaying a large number of parameters. Currently, the designed monitoring system for the coal conveyor belt at Jiujiang Petrochemical is in operation and performing well. The author's innovation lies in the fact that the instrument's communication program follows the protocol of Advantech's multi-channel A/D Adam module ADAM-5017, avoiding the need to develop a driver program between the host computer and the instrument, thus significantly shortening system development time.

References:

[1] Wei Junlan, Ding Zhenrong. Communication method between KingSCADA 6.5 and microcontroller [J]. Industrial Control Computer, 2004, 17(10), 58-59.

[2] Zhang Xi, Wang Deyin, Zhang Chen. C Language Programming for MSP430 Series Microcontrollers [M]. Beijing: Posts & Telecom Press, 2005.

[3] ADAM-5000 Series RS-485 Based Data Acquisition and Control System User's Manual.

[4] Lü Penggang, He Chengbo, Liu Kaipei, et al. Automatic dosing system for thermal power plants based on Adam module [J]. Microcomputer Information 2001, 17(11): 19-20. [5] Beijing Yacon Technology Development Co., Ltd. KingSCADA 6.51 User Manual. 2005.

Read next

CATDOLL 146CM Laura TPE

Height: 146cm A-cup Weight: 26kg Shoulder Width: 32cm Bust/Waist/Hip: 64/54/74cm Oral Depth: 3-5cm Vaginal Depth: 3-15c...

Articles 2026-02-22