Anti-interference design of serial communication system based on intelligent communication controller

Publisher:SereneHarmonyLatest update time:2012-07-19 Source: mcu99 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The safety of power system operation is closely related to the current operating status of the system. For the power dispatching department, if the operating status of each part of the power system can be fully grasped in real time and remote monitoring can be carried out, it will undoubtedly be of great significance to ensure the safe, stable and economical operation of the system. Power remote monitoring generally uses serial communication, and ensuring reliable data transmission is one of its most important technical indicators. Due to the harsh environment of industrial sites and the long-distance transmission of distribution systems, interference is the main reason for accidental errors and affecting the reliable operation of the entire system. Improving the anti-interference ability of the system is an important research direction for power remote monitoring.

System Overview

This system is an industrial power distribution measurement and control system in the form of upper and lower computers. According to the functional requirements, the lower computer uses the Advantech IPC-610 industrial control computer (IPC: Industrial Personal Computer) with relatively powerful control functions. It has a passive bus backplane with nearly 20 ISA slots and PCI slots, as well as corresponding CPU boards, I/O boards, etc., which can combine various modules of the system such as A/D conversion, video acquisition, communication, I/O port input and output in the form of plug-in cards like building blocks, and easily expand into a complex control system. Two PC-6313 multi-function analog input/analog output boards are selected, and the corresponding sensors and actuators are connected to complete the tasks undertaken. Each lower computer can detect and control multiple analog quantities and switch quantities as needed. This system detects 64 analog quantities (voltage, current, power factor, active power, reactive power, etc.) and 16 switch quantities (opening and closing status of each outgoing switch, status of compensation capacitors, etc.) as needed, and can output control the 16 switch quantities (switches, solenoid valves, relays). Its structural block diagram is shown in Figure 1.

Click to browse products in a new window

Figure 1 Block diagram of the lower computer system

The host computer can be a common PC, or it can be an IPC like the slave computer according to the system usage environment. The host computer can send instructions to communicate with any slave computer connected to it, collect analog and switch information transmitted by each slave computer, perform relevant analysis, summary, report generation and other processing, and monitor and macro-dispatch each slave computer subsystem.

In the power distribution measurement and control system, the upper and lower computers are far apart. In order to improve the anti-interference ability of the system, the RS-485 serial communication bus standard is adopted. The RS-485 bus adopts differential transmission, which has the characteristics of long transmission distance, many contacts and few connections. It has become the preferred standard for data transmission in distributed monitoring systems. IPC does not have an RS-485 interface, so it needs to be equipped with an RS-232/RS-485 interface. This system uses the 7250/7521 converter of ICP DAS. Among them, 7521 is an intelligent communication controller with an embedded CPU, which can reduce the amount of system programming and improve the reliability and real-time performance of the system. This system actually uses the 7521D module, which has 5 seven-segment digital tubes on it. Its on and off can be controlled by the program to monitor the operation of the system. In addition, the functions of 7521D and 7521 are the same. In the following introduction, no distinction will be made between 7521 and 7521D.

The wiring diagram of the communication module of this system is shown in Figure 2. It is designed that one upper computer controls eight lower computers, and it can also be expanded according to the actual needs of the distribution system.

Click to browse products in a new window

Figure 2 Schematic diagram of network connection with intelligent communication module

Introduction to 7521 Intelligent Communication Controller

7521 Function Introduction

7521 is one of ICP DAS's 752N intelligent communication controllers, which can support one RS-232 device. The module is embedded with AMD's Am188TMES controller and equipped with MiniOS7 embedded operating system. A unique address can be assigned to any RS-232 device in the RS-485 network. The module contains dual watchdog circuits: a hardware module watchdog and a software host watchdog to protect the host and 7521 module. At the same time, its RS-485 end has 3000V high-voltage isolation, which can effectively prevent industrial noise interference.

The 7520 module is an ordinary RS-232/RS-485 level converter and does not have intelligent communication functions. However, its RS-485 end also has 3000V high-voltage isolation. I will not go into details here.

7521 working mode

7521 has two working modes, one is development working mode and the other is normal working mode.

In development mode, connect the COM1 port (RS-232) of 7521 to the serial port of PC and set the communication format. 7521 will use the keyboard of PC as its standard input and the monitor of PC as its standard output. In this mode, system parameters can be configured and user programs can be downloaded.

In normal operation mode, 7521 will execute the program pointed to by AUTOEXEC.EXE file. When used as an intelligent communication controller, 7521 has two files pre-installed in its FLASH ROM: AUTOEXEC.EXE and 7521.EXE. After booting, 7521.EXE can be automatically loaded by AUTOEXEC.EXE file to complete the initial configuration of intelligent communication. Users can also download their own applications to 7521 to change the functions of 7521. [page]

7521 module function command brief description

The commands of 7521 are divided into two parts: the command sent by the main control computer to the module and the response of the module after receiving the command.

The command format of the sending part is: (leading character)(address)(CHK)(CR), each item is explained as follows.

①(Leading character): 1 byte, indicating the type of command. The control commands of the module are usually divided into several different types, which are classified by leading characters using some special characters such as $, #, ~, etc.
②(Address): Two bytes, indicating the module to which the command will be sent. The address range is 00~FF, so there are 256 addresses.
③(Command): 1 or more bytes, specifying the command executed by the module. These commands usually use different numbers to represent different functions.
④(CHK): Redundant checksum (CheckSum), use the program to add the address values ​​of all transmitted characters in the ASCII control code, keep the last byte, and split it into the front and back two characters as the check value.
⑤(CR): Enter key, vbCr in VB, indicating the end of the command.

After receiving the command, 7521 will return a response string to the host in most cases. The response string format is: (leading character) (address) (data) (CHK) (CR)

The response string (data) is different from the command string in format, and the rest are the same. The data part should be interpreted according to the specific command.

7521 has 30 practical commands and provides a relatively complete driver. Users do not need to write communication protocols by themselves. They only need to install 7521.exe and related archive files on the host computer according to the operation manual, correctly connect the computer and 7521 module, and start working after initialization.

Anti-interference design of upper and lower computer communication system

Although the RS-485 bus standard has strong anti-interference ability, in actual use, due to the harsh on-site environment, electromagnetic interference and other conditions, it will still affect the reliability of communication. The most typical problem is the occurrence of bit errors in data transmission, and serious problems may cause system crashes. Therefore, it is very important to take necessary measures to improve reliability and anti-interference ability. In this system, anti-interference design is carried out from both hardware circuit and software design.

System communication hardware anti-interference measures

In terms of hardware circuits, the main considerations are isolation, interface standards, and wiring.

(1) The RS-485 interface of this system adopts a combination of balanced driver and differential receiver, and uses shielded twisted pair cable, which has good anti-noise interference performance.
(2) During the communication process, due to impedance discontinuity and impedance mismatch, signal reflection may occur, affecting the signal transmission distance. The characteristic impedance of twisted pair cable is generally between 110 and 130Ω. This system connects a 120Ω matching impedance at the end of the transmission line to eliminate signal reflection.
(3) The 7520/7521 selected in this system are both RS-232/RS-485 conversion interfaces with 3000V isolation, as shown in Figure 3.

Click to browse products in a new window

Figure 3 Schematic diagram of the internal circuit of the 7520/7521 module

As can be seen from Figure 3, the RS-485 terminal and the power supply terminal are in the same area, and the RS-485 terminal uses the access power supply. The RS-232 terminal uses the converted power supply inside the module, and the power supply has a 3000V isolation measure before and after the conversion. Since the source of noise mostly comes from the power supply terminal, strong noise will follow the power line into the module, but as long as this interference is within the protection range, it can ensure that the equipment on the RS-232 terminal will not be damaged, thereby achieving the purpose of protecting the host computer.

The protection principle of 7521 is the same as that of 7520, which can protect the downstream computer from noise interference in the RS-485 network.

Anti-interference measures for system communication software

In actual system design, to ensure the reliability of data transmission, it is necessary to coordinate the work of hardware and software. To ensure the accuracy of data transmission, certain measures must also be taken in software design.

(1) The 7521 intelligent communication controller has a CheckSum check function. The cumulative sum check method is used during data transmission, which can greatly reduce the data transmission error rate. The calculation method of CheckSum is shown in Figures 4 and 5.

Click to browse products in a new window

Figure 4: Accumulation and verification process when outputting commands

Click to browse products in a new window

Figure 5 Check the accumulation and verification process of the returned results

For example, if the command string sent is $012[Enter], add the ASCII values ​​of the leading character ($), address (01), and command (2) to get the following result:

CheckSum=0×24+0×30+0×31+0×32=0×B7

The last two characters are "B" and "7". Put them after the command and before [Enter]. The final string sent is $012B7[Enter], thus completing a command string with CheckSum. [page]

When the host sends a command using the CheckSum method, the CheckSum value must be calculated first. The module that receives the command will also perform a CheckSum calculation on the received string. When the two results are consistent, the transmission is considered correct. If the two results are inconsistent, the module will return a corresponding error message.

Similarly, when the host receives the string returned by the module with CheckSum activated, it must also verify the Checksum value to confirm the correctness of the transmission process.

The factory setting of 7521 is to disable CheckSum. In order to ensure the correctness of data transmission, this system is designed to activate CheckSum, which can be activated by command $AAKN.

(2) The 7521 module contains two watchdog mechanisms. The first mechanism is to monitor the hardware watchdog of the 7521 module. It belongs to the hardware reset circuit and runs automatically after power-on. Its watchdog timing is 1.6s. This circuit monitors the operating status of the module. When the module is in a bad working environment and does not work properly, this monitoring circuit will automatically reset the module. When the system is working normally, the dog should be fed at least once within 1.6s to avoid reset. If the 7521 is reset, the "$AA5" command can be sent to restore it to normal. The process is shown in Figure 6.

Click to browse products in a new window

Figure 6 7521 hardware watchdog reset solution

The second mechanism is the software host watchdog. The software host watchdog can monitor the status of the host. If the host crashes, all 7521 output modules will return to their preset safe mode for safety protection. When the host is operating normally, a "host normal" command should be sent at regular intervals to avoid the watchdog reset. The process is shown in Figure 7

Click to browse products in a new window

Figure 7 Software host watchdog process

Experimental test data and analysis

According to the system design and laboratory conditions, the serial communication data was tested, as shown in Table 1.

From the above analysis results, it can be seen that adding the CheckSum checksum and watchdog mechanism of the intelligent communication controller to the RS-485 serial communication system can effectively reduce the bit error rate of serial communication and improve the success rate of communication data. The anti-interference ability of the system has been greatly improved.

Conclusion

This system has a relatively complete anti-interference design from both hardware and software aspects. Since the intelligent communication controller has its own CheckSum check and hardware and software watchdog functions, it only needs to be activated by the corresponding command. The hardware cost and software workload are reduced, and the scalability and maintainability of the system are enhanced. Experiments have proved that this system has good real-time performance and reliability, and the data bit error rate is very low. With the help of software filtering and redundancy check and other measures, the system performance can be further improved. Therefore, this article has a certain theoretical and practical reference value for similar designs.

Reference address:Anti-interference design of serial communication system based on intelligent communication controller

Previous article:Design of image recognition system based on SPCA563B chip
Next article:Error Analysis and Improvement of SPI Interface

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号