Design of pressure sensor based on PROFIBUS-DP
The traditional industrial control system adopts the distributed control system based on PC, PL and DAC, and adopts I / 0 connection mode. The sensor still uses the analog current signal of 4 ~ 20m a for data transmission, and the system has some shortcomings such as poor integration ability, poor openness and release of hardware and software, poor reliability and maintainability. Fieldbus technology integrates control technology, computer technology and network communication technology to realize the digitalization, networking and intelligence of industrial control system, and represents the development trend of today's industrial automation and process control technology [1]. Support field bus international standard IE C-61158, the typical field bus has L-w working bus, PR-F-IB bus, C-A-N bus, H-A-R-T bus, etc. Among them, the market share of PRO Luu S fieldbus products ranks first.
Profibus-d P is a part of the field bus standard PROFIBUS protocol, mainly used in the field layer (sensors and actuators) high-speed data transmission, instead of 24VDC or 4 ~ 20mA signal transmission, the master station periodically read the input information from the slave station and periodically send output information to the slave station. The response time is several hundred s ~ several hundred m S, the maximum data transmission capacity of DP slave station is 246 bytes, its transmission technology uses RS-485 twisted pair wire, the transmission rate is 9. 6 kb it/s~ 12M bit/s[2]
The sensor with the field bus PRO FIBU S-DP communication interface can be directly connected to the PRO FU S-DP field bus control system as an intelligent slave station, which brings great convenience to the hardware configuration and networking of the whole system. Many well-known foreign manufacturers have launched sensor products with fieldbus communication interface, such as S IE M E N S, P + F company with P R O F b U S-D P communication interface absolute encoder, transmitter; Electromagnetic flowmeter with PR, Fb, S-DP communication interface produced by E + H company [3]. In this field of technology, China still has a certain gap with foreign countries. According to the PRO F IBU S-DP protocol, the hardware circuit and software of the pressure sensor with PRO FIB U S-DP communication interface are designed using the special chip SPC 3 of SIEM E N S company.
1 Hardware circuit design
The hardware circuit OF the pressure sensor with the PR OFIBU S-dp communication interface is composed OF the pressure sensor, the instrument amplifier, the second-order low-pass filter, A/D conversion circuit, the microprocessor μU, the WTT circuit, the PR OFIBU S-dp protocol chip pc3, the photoelectric isolation, the bus driver, etc. The whole circuit takes the microprocessor as the core, collects and processes the pressure signal, and sends the data to the input buffer of SPC3. After the master station obtains the token, it reads the data from the input buffer of sgpc3 and completes the data communication. The block diagram of the whole hardware circuit is shown in Figure 1.
(1) The pressure sensor uses the high-precision silicon piezoresistic pressure sensor 100 PX 2 g P produced by MOTOROLA, which uses laser fine-tuning technology, and the zero drift output of the bridge is less than lm V; The full scale output is 40 M V 1. 5 m V, consistent sensitivity, strong interchangeability, the use of thermistor temperature compensation network, dynamic temperature compensation effect is significant, high precision.
The differential amplifier consists of a high input impedance integrated operational amplifier CA3140, as shown in Figure 2. Let R1 = R2= R, 3 =R4 =R5=R, 6=R7.
Figure 2. Amplifying and filtering circuit diagram of pressure sensor
The second-order low-pass filter uses Sauen Key filter commonly used in measuring instruments, with a cutoff frequency of -3dB of 5H z and a closed-loop gain of 1, as shown in Figure 2. The main performance of the second-order low-pass filter is determined by the cutoff frequency and quality factor Q, and the value of Q determines the passband width of the low-pass filter
(4) A/D conversion circuit A/D conversion circuit uses AD754, AD754 is A single channel input, 12 bit output successive approximation type A/D converter, conversion speed of 15 ~ 35s. The d75 4 output has a three-state control, the output data can be directly hung on the data line, and the 12-bit data is divided into high 8-bit and low 4-bit output. When the MCU executes the external data memory write instruction, make C E = 1, C S = 0, R/C = 0, the beginning 12-bit conversion is valid. Through P3. 0 Query the daily status of the S/T/S terminal. When s1 = 0, the conversion is complete. After that, when C E =1, C S = 0, A0=1, the high 8 bits are read;
(5) SPC3 and its interface circuit with the CPU is a ASSIC S slave intelligent communication chip produced by SIEM E N S that supports the PRO F IBU S-DP protocol. Its main technical specifications are as follows: independent processing of PR, F, IB, U, S-D, P protocols. The maximum data transfer rate is 12M bit/s, and the data transfer rate can be automatically detected and adjusted. Compatible with 80c32, 80x86, 80c165, 80c166, 80c167 and HC11, HC16, HC91 6 series chips. 44-pin, PQFP package. Integrated watchdog (W D T), external clock interface 24M H z or 48M H z, 5V DC power supply.
The SPC3 is integrated with 1.5kbyte information message RAM memory, mode register 1 and mode register O, status register, interrupt control register, input and output registers and diagnostic buffers. Organizational parameters can be set in the RAM unit starting from 16H, and the commonly used parameter data and status display, such as address, user watchdog value, device symbol number, can also be set in this unit. User buffer Settings start at 40H. Mode register 0 Sets the working mode of PRO FIB U S-D-P, which is assigned in offline state and cannot be modified on the power supply. Mode register 1 can also be set and reset after power-on. The address number of the sensor slave station can be set by the master station. If the slave station address does not change, then R ea 1-N o-A dd-C h A g = 0 F F h, R -S S A _B U F_P T R = 00 h. SPC 3 contains 14 non-priority interrupt sources, which implement interrupts through interrupt mask registers and interrupt response registers. The interrupt response register is not required for new parameter data interrupts and new assigned data interrupts. The user can set the polarity of the interrupt signal. Diagnosis is divided into external diagnosis and state diagnosis. External diagnostics require users to write user data to cells starting with the 7th byte. The status check must be written to 0 0H of the first byte. The initial value of the user watchdog counter can be set in the R-U-use r_ W - d-V-value unit.
The CPU uses AT89S52, pin 31 is connected to high level, and on-chip memory is used. The interface circuit between CPU and SPC3 is shown in Figure 3.
Figure 3 Interface circuit between CPU and AD754, SPC3
(6) optical isolation and bus driver circuit RS-485 bus driver one side is connected with SPC3 through optical coupling, the other side is connected with 9-pin D-type socket,RS-485 bus driver SN75ALS176 to meet the 12M bit/s transmission rate, optical coupling HCPL7720, In order to eliminate external interference and improve the anti-interference of the system, the electrical isolation of the power supply also uses DC-DC module DCP0505 to achieve 5V to 5V isolation conversion.
2 Software Design
After the system is powered on, the first step is to initialize $89C52 and SPC3. Initialization of $89c52 includes setting timer, interrupt class type, and interrupt priority; The initialization of SPC 3 includes setting the interrupts allowed by SPC 3, writing the slave station identification number and address, setting the SPC 3 square register, setting the diagnostic buffer, parameter buffer, configuration buffer, address buffer, and initial length. Based on the above initial values, the pointer to each buffer and the pointer to the secondary buffer are calculated. After checking that the parameter data of the master station is consistent with that of the master station, the master station starts to set indicators such as the number of input and output bytes and the number of diagnosis bytes of the slave station. The slave station can exchange data with the master station only when the configuration data of the master station matches that of the slave station. This process is carried out under the state mechanism of PRO, IBu and DP [6].
SPC 3 integrates the full PRO FIB U S-DP protocol, so the ~ 9C52 does not need to participate in the DP state machine. $89C52 According to the interruption generated by PC3, the data sent by the master station received by PC3 is stored and processed, and the engineering quantity data processed by the MCU is sent to the master station through SPC3. The interrupt program is mainly used to process PR_M packages, CFG packages, SA packages, etc. [7]
3 Closing remarks
The pressure sensor with the PROFIBUS-DP communication interface can be used as a slave station for easy connection to the PROFIBUS-DP fieldbus master station. Through the joint test with Siemens S 7-300 PL C (including PR, F, IB, DP), the data communication between the sensor and the LP master station is stable and reliable, and can be widely used in the industrial control system based on PR, FIBU S-DP fieldbus.
Reference
[1] Yang Xianhui. Fieldbus technology and its application [M]. Beijing: Tsinghua University Press, 1996:1-10
[2] Li Zhengjun. Fieldbus and its application technology [M]. Beijing; China Machine Press. 2005:321-323.
[3] Tang Jiyang. Fieldbus (PRO FIB U S) technology application guide [z]. China Mechatronics Technology Application Association Fieldbus (PRO F IB U S) professional committee. One, nine, nine, eight: seven, two - nine hundred.
[4] Ding Zhensheng. Sensing and its application in telemetry [M]. Beijing: Publishing House of Electronics Industry, 2003:45-52. (in Chinese
[5] S IE M E N S. S, P, C, 3. ~ e m ens P R O F IB U S C o n tro Ller[' Z -]. F uerth: S iem ens A G, 20 00 {6-15.
[6] Fang Yanjun, Xue Fei, Chen Meicheng. Design of a new thermocouple temperature measuring device [J]. Sensor Technology, 2005(11 1); 47-49.
[7] Li Zhengjun. Design of intelligent Data acquisition node based on PRU-S-DP Fieldbus [J]. Journal of Shandong University: Engineering Edition, 2003 (4) : 430-432.