Foreword: In industrial production and various scientific technical research, should often gather and deal with various data, the collection way that usually used is to accuse of the built-in installation data collecting card in the PC or engineering, such as A/ D card and RS-422 card, RS-485 card. It is apt to be influenced by internal environment of chassis to gather the card, and slot quantity of the computer and address, cutting off the restriction of resources, can’t connect a lot of apparatuses. Especially while carrying on the oil well and pressing and splitting homework, because it is more dangerous to press and split the working site, and need to gather and deal with pressing various data when splitting at the same time, in order to real-time monitor long-rangely, so deal with long-range data acquisition with the industrial computer, it is difficult to meet long-range data transmission and portable requirement. This text canvasses a long-range data collecting system based on one-chip computer and portable computer, already can carry on long-range data acquisition, and flexible to do benefit to carrying while being light, lowered the equipment cost at the same time. A main chip introduction
AT89C52 is a low power consumption, high-performance CMOS 8 one-chip computers, the ones that include 8k Bytes can wipe Flash read-only programm store which is written 1000 times repeatedly on-chip. The device adopts high density, non-volatile memory technology of ATMEL Company to make. AT89C52 has On-Chip arbitrary access data storage RAM of 128 bytes ,32 external two-way I/Os I/O The mouth, the two-step interrupt structure of a 6 vector, 3 16 programmable regular counters, the serial communication port of a full duplex, clock oscillator on-chip. In addition, it can be 0Hz and power saving mode that can be set up through the software that AT89C52 has also designed and disposed oscillating frequency. Under the idle mode, CPU delays working, and RAM regular counter, serial port, other interrupt system can continue working, the power down mode freezes the Shaker and keeps the data of RAM and stop other functions of the chip until external interrupt is activated or the hardware is reset.
AD574 is the American analog digital company Analog 12 comparing analog to digital converters one by one of high speed of one piece introduced, the hybrid integration that dual built-in polar circuit form changes the chip, connect few componentses, low power dissipation, the characteristic such as being high of the precision, and have automatic polarity transforming function of zero sum of automatic school, only need the resistor-capacitor unit which connects drib to form an intact analog to digital converter, there are four kinds of it imitates ranges of people of failing of voltage: 0-10V and 0-20V, the intersection of 0 and 5V and 0 – the intersection of and 10V, data output format, for 12 and 8 person available, this literary grace takes 12 data formats, so can improve the machine format precision.
MAX485 interface chip is a kind of RS-485 chip of MAXIM Company, it finishes changing TTL level into the function of RS-485 level. Adopt the single power 5V work, the rated current is 300 A, adopts the half duplex communication way, the data transmission rate is up to 2.5Mbps. Can connect 32 MAX485 transceivers at most on a RS-485 bus. So can carry on data acquisition to this multiple system at the same time through RS-485 bus line with a portable computer through programming.
2 systematic hardware design whole acquisition system is divided into sending end and data receiving end of data acquisition. Mainly AT89C52 one-chip computer, AD574A A/D sample chip, MAX354 error protection analog switch and MAX485 chip to form in the sending end of data acquisition, finish collection and serial machine format sending function of the multi-channel signal. The receiving end of data is transferred to the circuit of RS-232C level from a RS-485 level, and a walkie portable computer forms. End and sending end of data acquisition pass the cable link of a shielded paired line.
2.1 Sampling circuit of the data
The sampling circuit is made up of AD574 and MAX354, within one sampling period, carry on the Entry of No. 8 sequentially continuously the wheel is sampled, sampling circuit and connection of the one-chip computer are shown as in Fig. 1.
Pursue – a data sampling circuit
Adopt 8 passways of error protection analog switches MAX354 to pay choosing in sampling the passway, this can be through 89C52 address line A0, A1, A2 comes to control, sent to the input end of AD574 after the analog switch of signal passing.
Have ternary data latches within AD574, can link with P0 data one of 89C52 one-chip computer directly, have reference voltage and clock circuit within it, so does not need any components and parts and finish A/ D to change independently. After A/ D changes, AD574 sends out and cuts off the application to the break INT0 of 89C52, then the data after systematic pair conversion are dealt with. 12/ 8 of the terminal dead earthing of AD574, A0 port links with address line A7 of 89C52, divides and reads the conversion result of l2 location by 8 data buses twice under the control of address line A7 like this.
2.2 Data transmission and receiving circuit
In order to avoid in data transmission at a long distance, the data are interfered with by the scene, this system adopts MAX485 chip to change the signal level into RS-485 level, adopts RS-485 interface to carry on long-range data transmission. RS-485 is the American federation of electrical industry vtl machine EIA The ones that made utilized the balanced twisted pair to make and transmit the collinear much communication standardly. It adopts the differentiating signal to transmit; The transmission distance of maximum can reach 1.2 km; Maximum 32 joinable drivers and transceivers; The receiver minimum sensitivity reachable 200 mV; Transmission rate reachable 2.5 Mb/s of maximum. Meanwhile, RS- 485 agreement was exactly for the remote, highly sensitive, multi-point communication to make the standard. This, too in order that the function that this data collecting system carried on data acquisition of multi-point expand and establish the foundation in the future.
Structure and pin of MAX485 chip are all very simple, inside contains a driver and receiver. RO and DI ends are the output of the receivers and input end of the driver, only need to link with RXD and TXD of the one-chip computer respectively while connecting with one-chip computer; /RE and DE end and make send can carry respectively for receiving,as /at the time of 0 of logic in RE,there are in receiving state on device; When DE is the logical one, the device is in sending state, because MAX485 work is in the half duplex state, so only need to control these two pins with a base pin of the one-chip computer; A-end and B-side, respectively for receiving and differentiating signal terminal sent, when the level of A pin is higher than B, the data that representatives sent are 1; When less than the B-side in level of A, the data that representatives sent are 0. The interstar connection while connecting with one-chip computer is very simple. Only need a receiving and sending of signal control MAX485. Add matched resistance, general available resistance of 100 between the B-side and A at the same time.
Pursue – 2 data transmitting line
Pursue – 3 ” watchdogs ” Circuit
On the receiving end of data, what the serial interface gone to with computer in hand is adopted is RS-232C level, so also need to change RS-485 level. It is convenient for the portable computer because of adopting on the receiving end of data to need carrying, so it was on the market more small and more exquisite level switch interface that fastens that adopted herein, do not go into details here.
2.3 Master anti-jam measure
Input end in MAX354 adopt isolated amplifier carry on signal isolation, adopt voltage transformer of isolated amplifier the magnetic coupling of the signal, having isolated the line connection of the thorough fare, thus has cut off the interference source. Have shielding action of certain result in pressing interference of the engine on the apparatus of splitting like this.
Meanwhile, ” crash ” in order to prevent the one-chip computer from being influenced by interference ,it utilize by MAX706 chip design ” the watchdog ” Circuit, has improved the antijamming capability of the system, such as pursuing – 3. MAX706 a kind of of good performance low power consumption CMOS monitoring circuit chip, his internal circuit by the Power On Reset, can touch off ” watchdogs ” again Timer and voltage comparator,etc. make up. MAX706 only detects WCI pin has level jump transfer signals of level within 1.6 seconds, ” watchdog ” And the clear of timer restarts timing; After going beyond for 1.6 seconds, WCI pin still have a level jump transfer signal of level, ” watchdog ” The timer overflows, WDO pin exports the low level, and then touch off MR hand-restoring pin, make MAC706 reset, thus enable ” watchdogs ” And the clear of timer restarts timing, WDO pin exports the high level, RST of MAX706 resets and outputs the low level pulse that the pin outputs width of about 200 milliseconds, make the one-chip computer control system reset reliably, put into normal operation again. The control of MAX706 only needs to utilize P1.5 pin of the one-chip computer to pass the simple realization of programming.
3 systematic software design
Software design includes two respects: Mainframe program, data acquisition of the one-chip computer and firmware procedure that sent of the notebook computer. Among them, the writing of mainframe program can utilize VB language to be written, the communication of serial port was realized through the communication programming controlling part MSComm of Microsoft Visual Basic. After after reading the serial port data, need, carry on mathematic mean calculate every the intersection of passway and 10 data that gather, so can reduce the machine format influence of the interference to a certain extent.
The serial communication of 89C52 adopts the operating mode 1, baud rate is 9600bit/s, the transmission data adopt and inquire about the way regularly, can regulate and send machine format time appropriately depending upon need, timing periodically reads the sampled data stored, send to the upper computer through RS-485 interface in serial way. The procedure adopts C51 language with high readability to write, sees firmware flow block diagram – 4 in program flowchart. While writing the procedure of 89C52, need to deal with the sampled data. It is linear relationships because of data such as the oil that is gathered is warm, oil pressure, pressure of well head,etc. and signal voltage, pass a maximum value of given standard signal voltage measurement and a minimum, can obtain the proportionate relationship between signal voltage and measured data of different data. The data handling program is according to the linear proportionate relationship, 12 binary datas gathering the analog to digital converter AD574 first are converted to the actual measured value, and convert this value to the 32-bit microcomputer floating number according to ANSI/IEEE standard 754-1985, keep in the storage area that is presumed, there are 8 group data altogether, need the space of the 32 bytes to store the sampled data.
One standard floating number take up one piece double-word ‘ 32-bit microcomputer . Most significant position 31st The sign bit of a floating number, the most significant position is ” 0 ” Positive number, the intersection of location and ” the 1 ” It is a negative number hour; 8 indexes account for 23-30; Because stipulate the positive number part of the mantissa is always ” 1″ ,Only decimal part of mantissa of retainment ‘ 0- 22 . The advantage of the floating number is to utilize very small storage space 4B Can express the number with very high and very big and pygmy precision, has improved precision while carrying on data processing and operation.
Pursue – the main program flowchart of 4 one-chip computer firmware
This data collecting system presses to split in the oil field and succeeds in using on the apparatus. Practice has proved, compared with traditional data collecting system, this acquisition system is not merely light and portable, can prevent the interference of the on-the-spot environment cylindrical roller bearing effectively, and the use RS-485 bus line carries on long-range data acquisition, the oil of fracturing truck pressing the oil well and splitting in the homework course is warm, oil pressure, pressure of well head, mud density, and keep on the notebook computer, has strengthened machine format real-time handling capacity in other data, engineers and technicians can analytical data in time result,reduce crash rate of homework in the courses of if you can’t pigeonhole, split at oil welling.
My author innovates some: Through adopting the one-chip computer to carry on data acquisition portably, meanwhile, carry on long-range data transmission through RS-485, can prevent interfering with live effectively, raise the transmission distance of data, also establish the foundation that the apparatus carried on the expansion based on RS-485 total line transmission, it is convenient to carry on data acquisition and control to many apparatus with nodal bus lines through a portable computer.
Li QunFang, Huang builds. ” one chip microcomputer and interfacing ” [M ]. Beijing: Electronic Industry Press, 2002
Yang Bo, Li WanZhou. New multi-channel data collecting system [J ] because of the one-chip computer. Instrument technology and sensor, 2006 45-46
Mourn China, Jiang LiangZhong in the forest. Serial data acquisition of an one-chip computer and transmitting the design [J ] of the module. The microcomputer information, 2006 10-2 : 229-231
Render meritorious service in week. ” one-chip computer experiment and practice ” [M ]. Beijing: Beihang University publishing house, 2004
Admire the river, Zhao ZhongSheng late. Application [J ] of 89C51 one-chip computer in the data collecting system of multiple channel. Self-service instrument, 20006
Sun Dong, Han ShaoKun, Xing HuaiFei. Make RS-232/ RS-485 converter by oneself to employ [J ]. Electronic measurement technique, 20053