The distributed control system based on centralized management and decentralized control solves the defect that the centralized direct digital control system has too high requirements for the processing capacity and reliability of the controller. However, due to its certain closeness and incompatibility among the decentralized control systems, the distributed control system is difficult to realize network interconnection and information sharing.
The emergence of Fieldbus enables the fully digital, fully open, interoperable and completely decentralized fieldbus control system to be realized. Fieldbus control system has become a hot spot in the field of automation and will also become an important development direction of industrial process control.
Controller area network (can) is a multi master controller area network technology launched by Bosch Company in Germany in the field of modern automotive electronic technology. It can effectively support distributed and real-time control. It was first mainly used in the data communication of automotive internal electronic monitoring and control devices. Because of its high reliability and high real-time, it is widely used in industrial field control and other fields. Its outstanding feature is that it adopts a short frame structure with a maximum of 8 data bytes, which has short transmission time and high real-time performance; In addition, can protocol cancels the traditional concept of address coding and replaces it with lossless priority arbitration based on data block identifier, which brings great convenience to realize information sharing among modules in distributed control system.
Based on the main characteristics and development trend of CAN bus, in the transformation of the open electro-hydraulic servo control system in the electro-hydraulic Laboratory of our university, can bus is used as the fieldbus standard, and a fieldbus control system based on CAN bus intelligent node is constructed. The software and hardware design of the intelligent data acquisition module will be introduced in detail. The module can realize the functions of digital and analog signal acquisition, field data preprocessing, data transmission and communication with the monitoring computer.
Introduction to hydraulic servo system
The open electro-hydraulic servo control system includes several electro-hydraulic servo position control test-bed, electro-hydraulic proportional speed control test-bed and electro-hydraulic proportional force control test-bed. Each test bench is equipped with a set of intelligent data acquisition module based on CAN bus and intelligent control module with built-in control algorithm. Each decentralized acquisition module and control module form a control network through CAN bus. One PC is connected to the local network through the built-in can adapter card to simulate the process control of industrial field. PC is used as the control station for process control and monitoring, It can display the working status of each test bench in real time and send start and stop commands to each test bench. At the same time, it can also remotely transmit the field data to management computers such as engineer station through high-speed Ethernet to realize the hierarchical fieldbus control system as shown in Figure 1.
Figure 1 overall structure of open electro-hydraulic servo control system
System hardware design
As an intelligent field instrument, data acquisition module mainly includes two parts: hardware system and control software. The hardware part of the module takes 80C196KC Single chip microcomputer as the core of the acquisition module. The peripheral circuit mainly includes CAN bus interface, program memory, power monitoring and reset circuit, Gal decoding circuit, Di, a / D conversion circuit and module parameter setting circuit. The module structure is shown in Figure 2.
Figure 2 structure of data acquisition module
Introduction to 80C196KC Single Chip Microcomputer
80C196KC is a high-performance 16 bit single chip microcomputer launched by Intel company. Compared with MCS51 series MCU, MCS196 Series MCU has faster operation speed and richer on-chip peripherals, which improves the real-time performance of the control system, mainly reflected in the following aspects:
a. 8 / 16 bit dynamic bus configuration can be adopted to enhance the flexibility of the system.
b. The arithmetic logic unit in the CPU does not adopt the conventional accumulator structure, but uses the register register structure. The operation of CPU directly faces the 256 byte register, eliminates the bottleneck problem of accumulator in 51 single chip microcomputer, and improves the operation speed and data throughput.
c. There is a set of instruction system with higher efficiency and faster execution speed. You can operate on signed and unsigned numbers, 16 × 16 bits only 1.4 μ S (20MHz), 32 ÷ 16 bits, only 2.4 μ S (20MHz), in addition, there are 3 operand instructions, which greatly improves the instruction efficiency.
Choosing 80C196KC Single chip microcomputer as the core device of data acquisition module can meet the requirements of application system and ensure the reliability and real-time performance of the system.
Can bus interface circuit
The CAN bus interface is composed of the independent bus controller SJA1000 of Philips company and the interface chip 82C250. SJA1000 is compatible with its previous pca82c200 independent controller in software and pin, and adds many new functions: standard frame data structure and extended frame data structure, and both frame formats have single / dual receive filters; 64 byte receive FIFO; Readable error counters and programmable error warning limits, as well as listen only mode and self-test mode. The hardware connection is relatively simple: the data address bus of SJA1000 is time-sharing multiplexing, which can be directly connected with the P3 port of 80C196KC and the corresponding control line. It should be noted that 80C196KC is the processor of Intel company. Therefore, SJA1000 works in Intel mode, and the mode pin should be connected to the positive end of the power supply. In addition, only the positive jump is effective for the external interrupt of MCU, while the interrupt signal of SJA1000 is effective at low level. Therefore, the interrupt pin of single chip can be connected only after inversion.
The 82C250 device provides differential transmission capability to the bus and differential reception capability to the CAN controller. Its RS pin allows three different working modes to be selected: high speed, slope control and standby. In low speed and short bus length, slope control mode is generally adopted to limit the rising and falling slope and reduce RF interference. The slope can be controlled through the resistance connected from RS pin to ground. When the communication signal is transmitted to the end of the conductor, it will be reflected, and the reflected signal will interfere with the transmission of normal signal. Therefore, terminal resistance shall be connected at both ends of the bus to eliminate the reflected signal. Its resistance value is about equal to the characteristic impedance of the transmission cable, generally 120 Ω.
Digital signal acquisition circuit
One of the physical quantities to be collected by the electro-hydraulic servo test-bed is the displacement of the hydraulic cylinder. There are two kinds of displacement sensors in the laboratory: inductosyn and rotary photoelectric encoder. Both are equipped with a digital display measuring instrument with BCD code output. Directly collecting the digital quantity of the digital display meter can ensure that the acquisition module has the high precision of the instrument, avoid the error caused by collecting the front-end pulse of the sensor, and make the circuit more concise.
The number of effective BCD code bits of digital display instrument is 5 bits (number, ten, hundred and 2 decimal places), with another symbol bit, a total of 21 binary bits. 80C196KC chip does not have program memory, so P3 and P4 ports are used as address data bus. The remaining effective IO port resources of single chip microcomputer are less, so the parallel port must be expanded. Special expansion chip or general 74 series logic chip can be used for parallel port expansion. In order to simplify circuit and programming, common 82C55A parallel port expansion chip with 24 channel IO port can be used. The output of the field digital display instrument is non-standard TTL level. In order to realize the compatibility and isolation between the module and the front-end instrument, tlp521 optocoupler is used for level conversion and signal isolation of the input digital signal.
A / D conversion circuit
The A / D converter in this module adopts AD1674, which is compatible with AD574, with 12 bit resolution, input voltage range of 0 ~ ± 10V or 0 ~ ± 5V, single bipolar optional, and conversion time of 10 minutes μ s. The maximum acquisition rate of single channel is 50KHz, the chip is equipped with reference voltage, three state buffer and sample and hold circuit, which fully meets the needs of the design.
The analog voltage signal comes from blr1 tension compression load cell, the pressure measurement range of the sensor is 0 ~ 5000kg, and the output voltage signal is 0 ~ 16mv. In order to adapt to the input voltage range of AD1674, the weak voltage signal of the sensor needs to be amplified, but there are many noise sources at the same time: sensor internal resistance, cable resistance, amplifier circuit and electromagnetic interference sources around the circuit. Therefore, the voltage signal front end uses low-pass filter and differential amplifier AD620 to suppress differential mode noise and common mode noise, as shown in Fig. 3.
Set vs as the signal voltage of the sensor, vn1 and vn2 as the induced noise signal of the external noise source on the cable line, and VNS as the circuit noise. Therefore, the output voltage Vo of the differential amplifier is:
Vo=A（V1-V2）=A（Vs+Vns+（Vn1+Vn2））； If the spectrum of noise source and signal source does not overlap, after passing through low-pass filter circuit: VF ≈ AVS.
Gal decoding circuit
In this module circuit, there are many MCU extended peripheral devices, including program memory at28c256, can controller SJA1000, parallel port expansion 82C55A and a / D conversion AD1674. 196 single chip microcomputer mainly works under the 8-bit bus width in the module. Because AD1674 adopts 12 bit parallel output mode, it is also necessary to dynamically change the bus width. In order to simplify the circuit and meet the requirements of high bus speed of 196 single chip microcomputer, the decoding circuit abandons the traditional gate circuit combination method and adopts the multi programmable general array logic device gal16v8. This can reduce the number of components, reduce the complexity of the circuit, reduce the probability of failure and improve the flexibility of hardware design.
Gal16v8 pin assignment and logic expression are as follows:
！ CEROM=！ A15&！ A14&A13&！ A12#
！ A15&！ A14&A13&A12
# A15&A14&！ A13&！ A12#！ A15&
# A15&A14&A13&！ A12#！ A15&
#A15&！ A14&！ A13&！ A12#A15&！
！ CSCAN=A15&！ A14&A13&！ A12；
！ CS8255=A15&！ A14&A13&A12；
！ CSADC=A15&A14&！ A13&！ A12；
BUSWIDTH=A15&A14&！ A13&！ A12；
It can be seen from the above logical expression that the base address of the peripheral device address is determined by the highest four bit addresses A12 ~ A15, and the corresponding base addresses of at28c256, SJA1000, 82C55A and AD1674 are 2000h, a000h, b000h and c000h respectively. When AD1674 is selected, the bus width control pin buswidth of the single chip microcomputer will be set high and dynamically adjusted to the 16 bit bus width. At other times, buswidth is low, and the single chip microcomputer maintains the 8-bit bus width. Intcan and intadc reverse SJA1000 and AD1674 interrupt request signals respectively. Gal expression files are compiled with Abel software to form Jed files, which are burned into the chip with a general programmer, and can be burned repeatedly for debugging.
The reasonable design of control software is the key for the module to complete the data acquisition and communication tasks in real time and effectively, mainly including system initialization, can information processing, data acquisition and processing and other functional modules. The system opens a timing interrupt, and the timing time corresponds to the sampling period sent by the upper computer. There are two main ways to receive can messages: interrupt and query. In order to improve the real-time performance of the system and ensure that there is no data overflow in the receiving buffer, the interrupt receiving mode is adopted in the module. The can message is sent in query mode, that is, when data needs to be sent, the pre organized data frame is written into the transmission buffer register of SJA1000 according to bytes.
The initialization of SJA1000 is mainly to set the corresponding registers in the reset mode of SJA1000. When initializing the can internal register, it should be noted that the setting of communication rate of each module in the same network should be consistent. The simple initialization source program of SJA1000 working in basic can mode is given below:
LDB AL， #01H
STB AL， REG-CR ； Reset SJA1000
LDB AL， #0AAH
STB AL， REG-OCR ； Set the output register to normal output mode
LDB AL， #048H
STB AL， REG-CDR ； Enable the internal comparator and disable the clock output
STB #01H， REG-BTR0 ； Set baud rate to
250K (using 16m crystal oscillator)
STB #1CH， REG-BTR1
LDB AL， #00H
STB AL， REG-ACR ； Set acceptance code register
LDB AL， #0FFH
STB AL， REG-AMR ； Set acceptance mask code register
LDB AL， REG-CR
ANDB AL， #0FEH ； SJA1000 exits the reset mode
LDB AL， #02H
STB AL， REG-CR ； Set interrupt register to enable
The above program segments can initialize SJA1000 correctly. In order to improve program reliability and fault tolerance, the contents of SJA1000 register should be read out and compared in practical application, so as to judge whether it is written correctly.
Based on the above software and hardware design, the data link layer and physical layer included in the CAN protocol are realized. Because the CAN bus protocol does not define the application layer, it is necessary to define the high-level communication protocol in practical application, that is, the format of corresponding commands, parameters and data. The more popular high-level protocols based on can bottom protocol in the world are DeviceNet and CANopen. In simple applications, we use a user-defined simple communication protocol, which is not described here. The designed intelligent data acquisition module has been running well since it was applied to the electro-hydraulic servo control system. Due to the application of CAN bus, the flexibility, reliability and real-time of the distributed data acquisition and control system are greatly improved, and an effective experimental teaching platform of fieldbus control system is established. At the same time, the data acquisition module can also be easily transplanted to other control systems in industry, and form a CAN fieldbus control system with other intelligent control modules based on CAN bus.
Responsible editor: GT