In order to solve the problem of many kinds and quantities of intelligent building control points, an intelligent building control system based on embedded technology is designed, which adopts MODBUS.
Communication protocol, 485/232 bus structure, maximum communication distance 1200m, and the number of freely combined area controllers and control modules to form a control network are successful.
Good results have been achieved in solving this problem.
Keywords: MODBUS protocol 485/232 bus area controller for intelligent building
0 quotation
Intelligent buildings first appeared in the United States, and intelligent buildings in China originated from
In 1990s, intelligent building was the crystallization of modern industrial high technology.
It is the main node of the future "information superhighway" and a new step into the "digital age"
The product of xing. The so-called building automation system is the central air conditioning system and ventilation system.
System, water supply and drainage system, lighting system, power distribution system and elevator system.
Monitor. With the rapid development of high-tech information technology and computer network technology,
Optimal combination requirements of building structure, system, service and management
Higher and higher [4]. The way of system control has changed from centralized monitoring in the past to centralized monitoring in the past.
And a distributed control system replaced by a field controller with high processing capacity, which
The intelligent control system of building automation designed in this paper is specially designed for building intelligence.
Compared with Honeywell, Siemens and other building control products, the design structure is flexible.
The control is simple, and it is easy to carry out the secondary development of the software according to individual needs.
1 network structure
The structure of the control system is shown in figure 1, which is divided into three control layers. The upper level is
PC remote centralized monitoring, the lower layer is the control module, and the middle layer is the field area control.
Manufacturer. Each layer is networked through RS232/485 bus.
The main function of remote centralized monitoring platform is to provide real-time data display,
Preservation and maintenance of historical data, query and display, fault alarm and fault history inspection.
Query, parameter modification and query. PC remote monitoring platform is the main man-machine interface,
Therefore, the software design of the upper computer embodies the following three advantages: first, the control network will
Network-based information can transform information from different sources and formats into unified information.
Provide a unified browsing interface for client browsers, so as to better
Adapt to the needs of the information society; Second, the system based on SQL SERV-
ER database management information system has improved the information management function. The third is
The open network structure can communicate with other systems more conveniently.
(such as security system, fire control system). The software is based on delphi platform
It is simple and convenient to develop and load a large number of graphics.
There are four control modules, namely digital input-
Put), digital output module, analog input module.
(analog input), analog output module (analog output). control module
Block is the main executive mechanism of control system, that is, collecting digital signals and simulating.
It also outputs digital signals and analog signals. So each module
Each has an independent control chip, which is not only controlled by the field area controller.
Command, but also need to complete the input and output functions of the module according to the control command.
The intermediate layer field area controller not only communicates with the PC remote monitoring platform
News, receiving control commands and uploading real-time data, and then collecting through the control module.
Data, execute the control command. Obviously, the field area controller is the whole control.
The core hub of the system is self-evident, so it controls the whole area.
The hardware and software design of the equipment has undoubtedly become the focus and difficulty of the whole system.
2 regional controllers
2. 1 hardware circuit
The hardware circuit of regional controller is mainly composed of CPU and upper and lower computers.
Port, EEPROM and clock, keyboard and touch screen, LCD and digital analog/digital.
Quasi-quantity input and output unit. The hardware structure is shown in Figure 2.
The CPU of the regional controller is STC89C5 16RD2, which is new.
Instead of anti-interference/high-speed/low-power single chip microcomputer, the instruction code is completely compatible with tradition.
805 1 single chip microcomputer [1-3].
The area controller itself has a certain number of digital/analog inputs.
The output unit can be used as a supplement to the control module in the intelligent building control system.
Charging, but also can let the regional controller as a product supporting controller.
Use, flexibility.
The clock and EEPROM are connected to the CPU of the regional controller through I2C bus.
Answer the phone. I2C bus is transmitted between chips and modules through two wires (SDA and SCL).
Send a message. SDA is a serial data line and SCL is a serial clock line. These two lines
The wire must be connected to the positive power supply with a pull-up resistor, and its data is only on the bus.
It can only be transmitted when it is not busy. The CPU is the master device, and the clock and EEPROM are slave devices.
Device [9].
The controller CPU accesses the communication interface of the upper computer through SPI bus.
Step communication chip MAX3 100. SPI bus adopts three-wire synchronous connection.
Mouth. Its main feature is that it can simultaneously send and receive serial data; Can be seen as
Master or slave work; Provide a frequency programmable clock; Send end interrupt flag
Pool; Write conflict protection; Bus competition protection, etc. The communication interface of the lower computer is serial.
Half-duplex communication is realized by port interrupt.
In order to meet various input modes, the controller is equipped with both keyboard and touch.
Screen, that is, you can input control commands by pressing keys, or you can click directly.
Touch screen implementation. The keyboard adopts an independent keyboard; Touch screen adopts resistive touch.
Screen, resistive touch screen screen is mainly composed of two conductive layers. When a finger touches it,
When touching the screen, two conductive layers contact at the touch point, resulting in resistance.
Change, generate signals in X and Y directions, and then control them through the touch screen.
The controller detects the contact point and calculates the position of (x, y).
2.2 Software flow
Intelligent building control system is controlled by various points, such as temperature,
Humidity, flow, switch, etc. Hardware circuit is based on digital quantity, analog quantity and input.
Input and output provide a common interface, so each point is clearly identified and controlled.
Completely done by software. The field area controller is used to control the whole system.
The core of the system needs to detect its own input and output units and complete functions such as display and alarm.
Control decisions can be made according to the information provided by PC and control module.
Policy. Therefore, the software flow includes initialization, fault detection and handling, and control calculation.
Methods, communication between upper and lower computers, etc.
(Figure 3), initialization includes numerical values.
Initialization, interrupt initialization, communication
Initialization, display initialization; breakdown
Detection includes communication failure and feedback.
Fault, logic fault, etc. ; Control department
The point is mainly the reality of program algorithm.
Now, intelligent control of input and output
System, including keyboard/touch screen input
And LCD output, PC communication.
That is, remote PC and regional controller.
Communication, communication with the lower computer is
Area controller and control module
[5-6].
Building automation control system
Fault types are various, and fault handling methods are also different, so fault detection
Measurement and processing have become a difficult point in programming. In view of this situation, Cheng
Look-up table method (table 1) is adopted in the sequence, which successfully solves this problem.
Building automation control system
Fault types are various, and fault handling methods are also different, so fault detection
Measurement and processing have become a difficult point in programming. In view of this situation, Cheng
Look-up table method (table 1) is adopted in the sequence, which successfully solves this problem.
The table has five columns, the first column is the fault number; The second column is the fault handler.
Methods, such as 1 (close), 2 (close), 3 (restart) ... The third column judges yes.
There is no linkage, such as 0 (No), 1 (Yes), which mainly judges some interrelated departments.
Whether the fault needs synchronous processing; The fourth column is the so-called alarm delay header.
Refers to the time when a phenomenon appears repeatedly as a fault, in order to eliminate it.
False alarm caused by jitter; The fifth column delay register stores the alarm delay, for example
1(0. 1 sec delay register), 2 (sec delay), 3 (step delay).
Each fault should correspond to one in the table, and only need to fill in the table in practical application.
Grid, fast and convenient.
The communication program of the upper and lower computers adopts MODBUS communication protocol [7-8].
Modbus protocol is a universal language applied to electronic controllers. through
Through this protocol, the controllers communicate with each other, and the controllers communicate with each other through a network such as Ethernet.
Network) and other devices can communicate. It has become a general industrial standard.
Quasi. When communicating, the protocol determines that each controller should know their settings.
Prepare the address, identify the message sent by the address, and decide what action to take.
If a response is needed, the controller will generate feedback information and use Modbus protocol.
The transmission controller uses the master-slave technology, that is, there is only one device (master device).
Ready) can initialize the transmission (query). Other devices (slave devices) are set according to the master device.
Prepare to query the provided data and respond accordingly. In this system, when the master device
When the upper PC is used, the field area controller is a slave device, and when the field area control
When the controller is the master device, the control module is the slave device. Modbus protocol is established.
The format of master equipment query: equipment (or broadcast) address, function code and all.
Data to be sent, error detection field. The slave response message is also sent by Mod-
The composition of the bus protocol includes determining the domain to be acted on, any data to be returned,
And an error detection field. If an error occurs during message reception, or
The slave device cannot execute its command, and the slave device will create an error message and send it.
Send it out in response.
For example, when the master device (field area controller) sends a request as shown in Table 2.
All control modules connected to the controller accept the request, but only
The control module with the address 1 responded to this request, and the control modules at other addresses also responded to this request.
Block automatically discards this frame of data. After CRC check data is correct, according to the function
The code for processing this frame data, in this example, the function code is 06, that is, to this register.
Address and write register data. After completion, the slave device needs to respond to the same request as the master device.
Information.
The number of regional controllers and various control modules is flexible and changeable, which can
Adapt to a variety of input and output signals, and develop control software according to the actual needs of users.
Pieces, really tailored to become a major feature. The intelligent control system has been
It has been used in intelligent control of many buildings, with accurate control and stable operation. in addition
External and regional controllers can also be used independently as supporting controllers for products, which is successful.
Used in dehumidifiers, cold dryers, volatile organic compound gas removal devices, etc.
refer to
1 Yu Hongzhou 5 1 anti-interference design of serial single chip microcomputer software [J] integrated circuit communication 2007,
Volume 25, No.2: 16- 18
2 Wang Wen, Chen Lin' Principle and Application of Single Chip Microcomputer' [M] Huazhong University of Science and Technology Press
3 Yu Shouqian Wang Jianhua Kou Jinqiao. Embedded integrated servo-
Intelligent module controller [J] high technology
Letter 2006, 12, 1:37-4 1.
4 b. Alternative development of intelligent energy management network
For building automation, programmable controller FAC-
Toli Automation (PLC FA) 2005, 3:28-30
5 Xin Huang, Song Yang. Software anti-interference technology and its application in single chip microcomputer. Modern electronic technology.
Surgery, 2007, 9: 90-92
6 Zhu SCM application in industrial control [J] China Science and Technology Information, 2005.
18A: 77-79
7 Tian Yongjun, Zhao Guangqiang, Zeng Jianping PC and MCU based on RS485 bus technology
Multi-computer communication design [J] Journal of Hunan Institute of Technology: Natural Science Edition, 17, 2007
Phase II: 19-23
8, Zhang Xianbin Modbus protocol in serial communication research and application [J] Yangtze River
Journal of Engineering Vocational and Technical College, 1, 2007: 30-32.
9 MODBUS extension protocol design of Zhao Xuejun RS485 bus measurement and control module [J] automation
Chemistry and Instrument, 2007, No.2: 37-40