Technical background
At present, in general mini-system, general what adopt is the scheme of " single-chip microcomputer+sampling device or control device " based on the hardware systems framework mode of signals collecting and processing, be that single-chip microcomputer communicates to connect by the sampling A of its general I/O interface with the periphery, though this scheme implements simply, its shortcoming also is tangible:
1, its communication interface must cause traffic rate very slow by writing corresponding scm software reality;
2, the different components of same-interface can not shared some signal wire, causes the original just very limited Single Chip Microcomputer (SCM) system of resource to seem nervous more;
3, because traffic rate is slow, sampling and control seem that all real-time is not strong, can't be full of the higher application scenario of requirement of real-time control.
Along with the continuous development of SIC (semiconductor integrated circuit) technology, new high performance device constantly occurs, and makes above problem obtain a good solution.The utility model proposes under such background just, not only can effectively solve above problem, all is greatly improved in speed, precision aspect sampling, the control.
Based on the embedded microprocessor of ARM be at present should be wider microprocessor, be widely used in each field such as various Industry Control, consumer electronics, Aero-Space, it is travelling speed, abundant internal resource, extensibility and good cost performance simply and easily faster, make it use constantly and enlarge, and have and progressively replace the trend that the conventional one-piece machine controller becomes the control platform of main flow.
At DA (number-Mo) aspect the control, general way is to select the DA device of respective type for use according to the needs of controlling object, in the occasion of accurately control, select general DA device for use because the error that device itself exists causes accuracy can't satisfy all the time, traditional way became and selected the DA device that various performances are higher, precision is higher for use this moment, thereby caused cost high all the time.
The utility model content
The purpose of this utility model provides a kind of input control circuit based on embedded microprocessor SPI interface, can improve the communication speed between microprocessor and the controlled device and solve the problem of its interface resource anxiety.
The purpose of this utility model can realize by following technical measures: a kind of input control circuit based on embedded microprocessor SPI interface comprises: embedded microprocessor, AD sampling module, DA control module; Described AD sampling module, DA control module all are connected with embedded microprocessor by spi bus, and embedded microprocessor switches between different chip selection signals to be realized communicating to connect with different SPI devices.
By SPI interface integrated in the microprocessor, realization AD sampling module is sampled to the controlled device current and voltage signals, obtain exporting control data after the computing of sampled data process microprocessor, the output control data is undertaken by the DA control circuit, thereby realizes the control to controlled device.
As to further improvement of the utility model, described DA control module is made up of DA governor circuit and DA compensating circuit; Output control signal data by the DA governor circuit is to controlled device, by the output of DA compensating circuit output compensating signal data to the DA governor circuit; Realization is to the output compensate function of controlled device, thereby realization is to the accurate control of controlled device.This circuit can effectively satisfy the needs that present routine sampling detects control system, and the precision of its sampling and control can reach in the 0.5mV under 5V reference voltage condition, has realized higher performance with lower cost.
As to further improvement of the utility model, also comprise the photoelectricity coupling buffer circuit that is used for input/output signal is carried out light-coupled isolation, to reach the purpose of protection microprocessor system.
Compare with original technology, the utility model has the advantages that: made full use of the SPI interface that has in the high-performance microprocessor, realize communicating to connect with same interface with three peripheral SPI devices, realization has realized the accurate control to controlled device simultaneously to the input sample and the output control of controlled device simulating signal.Under the prerequisite that guarantees traffic rate, effectively save system resource, improved the precision of sampling and the precision of output control.
Embodiment
As shown in Figure 1, be theory diagram of the present utility model, comprise based on the input control circuit of embedded microprocessor SPI interface: embedded microprocessor, AD sampling module, DA governor circuit, DA compensating circuit.The AD sampling module will import microprocessor system into through the built-in spi bus of embedded microprocessor from the data that controlled device is obtained, and DA governor circuit, the control data of DA compensating circuit after the built-in spi bus of embedded microprocessor is handled microprocessor system export controlled device to.
Embedded microprocessor is an embedded OS based on ARM9, is the core of whole application system, comprises that one of composition such as ARM9 embedded microprocessor, SDRAM, FLASH finish the necessary main devices of system.By the operation real time operating system, realize various general utility functions and specific function, in the embedded system as TCP/IP network service, usb data storage, file storage and management, graphical interfaces, signals collecting and control, algorithm computing etc.
It is AT91RM9200 that embedded microprocessor adopts model, it is the embedded microprocessor chip that includes the ARM9 kernel of a high-performance, low-power consumption, high reliability, low price, its frequency of operation is 189MHz, reach as high as 208MHz, possesses profuse peripheral hardware resource, as: the serial ports of sdram controller, Memory Controller, ethernet controller, multichannel, SPI controller, IIC controller, SD/MMC controller etc. are widely used in numerous Industry Control occasions.
The AD sampling module is responsible for voltage (if the current signal of the equipment of finishing to all detected objects, then to convert voltage signal earlier to) sampling, the AD sampling module adopts 16 precision 8 passage AD conversion chip ADS8344, this chip and master controller sampling serial SPI communication mode, its maximum sampling rate is 100kHz, the SPI serial communication maximum communication clock that chip is supported is 2.4MHz, and very at a high speed mould/number conversion and data-transformation facility can be provided.
The DA main control circuit is realized the output control to the controlled device current/voltage, makes it to finish response control according to the current/voltage numerical value of setting.The DA converter that the utility model adopts is 16 precision four-way DA converter DAC8554, adopts serial SPI communication mode between this chip and the microprocessor, and the maximum communication clock can reach 25MHz.
The Analog Output Chip of DA compensating circuit adopts the DA converter MB88347 of 8 passages, 8 precision, and serial SPI communication mode is adopted in communicating by letter between this chip and the master controller equally.
DA main control circuit and DA compensating circuit are superimposed by certain circuit design, finish the output control to the controlled device voltage signal jointly, and its precision can reach 0.5mV.
As shown in Figure 2, be the circuit theory diagrams of the used photoelectricity coupling buffer circuit of input/output signal in the utility model, photoelectricity coupling buffer circuit mainly comprises device OP17.Described OP17 adopts quick optocoupler isolator 6N137S, and the highest switching frequency can reach 10MHz; The OP17 left end is the input signal end, and right-hand member is an output signal end, and the electric power system at two ends is separate.What described optocoupler isolator OP17 adopted is the homophase isolation design, promptly when input signal is high level, the not conducting of light emitting diode on the OP17 left side makes the triode not conducting equally on OP17 the right, and the output signal of OP17 the right output is kept and drawn high level; When input signal was low level, the diode current flow on the OP17 left side activated the triode conducting on the right, and output is connected to ground by the triode of conducting, so output signal is a low level.
Two mutual disjunct power-supply systems are adopted at the two ends of described optocoupler isolator OP17, be the 3.3V system on one side, 5V system on one side, photoelectricity coupling buffer circuit can make the signal between the system of two varying levels realize the zero defect transmission, and anti-stop signal mistake occurs transmitting because of level differences.The very important effect of another one of photoelectricity coupling buffer circuit is anti-interference, because signal is transmitted by light in the two ends of photoelectricity coupling buffer circuit, even therefore the signal of input end has been subjected to interference, as long as its interference signal intensity is unlikely to influence light emitting diode, the interference of signal just can not be along with original signal reaches the other end.In commercial Application, controlled device tends to be easy to receive the interference of various interference sources, and this design can guarantee very effectively that the core control system of equipment can not be subjected to the influence of external disturbance, is an Anti-interference Design method commonly used in the industrial circuit design.
As shown in Figure 3, be the schematic diagram of AD sample circuit in the utility model, comprise modulus conversion chip U22, filter capacitor C99~C108, resistance R 114~R118, R120~R124, optocoupler isolator OP4~OP8 and reference voltage source U23.The analog sampling signal is by inserting 1~3,5,6 pin of described analog-to-digital conversion module U22 behind described filter capacitor C100~C104, the C106; Insert 11 pin of described U22 behind the filtering circuit of output pin 6 pin of described reference voltage source U23 by capacitor C 107 ground connection composition in parallel with C108; 17~19 pin of described U22 are connected with 6 pin of described OP6~OP4 respectively; 15,16 pin of described U22 link to each other with 3 pin of described OP8, OP7; 3 pin of described OP4~OP5,6 pin of OP8, OP7 are connected with the related port of embedded microprocessor.
Described U22 adopts modulus conversion chip ADS8344, and its right side interface is the SPI interface that communicates with microprocessor, at first isolates through high speed optoelectronic coupling isolator spare during signal and communication, and its left side interface is an input end of analog signal.The signal of sampling has 5 passages, wherein, and 2 channel voltage signals, 2 channel current signals, 1 channel temperature signal (current signal and temperature signal also are transformed into the correspondent voltage signal by circuit before conversion).In the practical application, maximum sampled signal is 8 passages.Described reference voltage source U23 model is REF02BU, and more accurate 5V reference voltage output can be provided, and its input voltage is 12V, can effectively improve the sampling precision of sampling A.
Shown in 4, the circuit theory diagrams of DA main control circuit in the utility model mainly comprise DA conversion circuit U35, reference voltage source U36, reverse voltage converter U37, capacitor C 136~C139, resistance R 270~R272, adjustable resistance VR1 and voltage-type amplifier U38~U40.Output pin 1 pin of described DA modular converter U35 inserts input pin 2 pin of described reverse voltage converter U37; 2,7,8 pin of described U35 insert in-phase input end 3 pin of described voltage-type amplifier U38~U40 respectively by resistance R 270~R272; 9~11 pin of described U35 are connected with the corresponding port of embedded microprocessor system respectively; Insert 3 pin of described U35 behind the filtering circuit of output pin 6 pin of described reference voltage source U36 by capacitor C 137 ground connection composition in parallel with C139.
It is the DA conversion chip of DAC8554 that described U35 adopts model, and its function is for converting the voltage signal of specific digital quantity to the voltage signal of analog quantity.The DA main control circuit can be realized the simulation output control of 4 passages, its input signal comprises that data input signal, clock signal, chip selection signal are all produced by microprocessor, be input to described DA conversion circuit U35 after coupling is isolated through photoelectricity, finish output conversion and control by described U35 at last.The effect of described reference voltage source U36 is the conversion accuracy that improves described U35.Described reverse voltage converter U37 model is INA132U, original positive voltage signal conversion can be output into negative voltage signal.Described voltage-type amplifier U38~U40 model is OP07CD, and it act as the burning voltage output signal.
As shown in Figure 5, be the circuit theory diagrams of DA compensating circuit in the utility model, comprise DA converter U52, voltage stabilizing diode VD1, filter capacitor C42, C35, resistance R 49, R51~R53.The 5V power supply is through being connected with ground connection voltage stabilizing diode VD1 behind the described divider resistance R49,8 pin VDD by the described U52 of access behind the filter capacitor C35 of ground connection between described R49 and the VD1; 12~14 pin of described U52 link to each other with the corresponding port of microprocessor by resistance R 53~R51; The 5V power supply inserts the 9 pin VCC of described U52 by described filter capacitor.
Described DA converter adopts the MB88347 of 8 passages, 8 precision, and its effect is the voltage signal that the voltage signal of specific digital quantity is converted to analog quantity.Described DA compensating circuit can be realized the simulation output control of 8 passages, its input signal comprises that data input signal, clock signal, chip selection signal are produced by microprocessor, be input to U52 in the DA converter through behind the optocoupler isolator, finish output conversion and control by U52 at last.Described voltage stabilizing diode VD1 produces the relatively stable voltage of 2.5V, and its effect is the conversion accuracy that improves U52.
As shown in Figure 6, for the circuit theory diagrams of DA compensating circuit in the utility model, comprise resistance R 72~R76, capacitor C 50, C55 and operational amplifier U32A to DA governor circuit realization compensation.The analog voltage signal of the output of DA governor circuit and DA compensating circuit connects the inverting input of described operational amplifier U32A respectively by described resistance R 72, R73; Be connected to inverting input and the output terminal of described U32A after described resistance R 74 and described capacitor C 50 are in parallel; The in-phase input end of described U32A is by described resistance R 75 ground connection; The output terminal of described U32A is exported by described resistance R 76; Insert filter capacitor C55 between two supply pins of described U32A.Resistance by configuration operational amplifier periphery superposes the two-way voltage signal and exports according to certain ratio.
Selected device is not the unique selection that realizes the present utility model purpose in the foregoing description, all can be replaced by other device with identical function.
The utlity model has very strong versatility, can be applied in the various systems about electric current and voltage detection and control, the realization of hardware and software is all very convenient and simple.Each module and the functional interface of circuit have very strong independence, can carry out cutting and replacement according to actual operating position; All devices have all used the packing forms of standard, and various input/output interfaces have all used the communication protocol and the device of standard, meet the standardization requirement of product.