Summary of the invention
The objective of the invention is to propose a kind of convenient and practical, the instrument that the Hall element TLE4997 of Infineon is demarcated and programmes of easy operating.
In addition, instrument of the present invention can also carry out Hall element side-play amount and Calculation of Gain and temperature compensation.
For achieving the above object, the technical scheme that the present invention proposes is: a kind of transducer calibration and programming tool comprise: host computer and interface alternation module, be the slave computer and the flush bonding module of its processing core with the single-chip microcomputer;
Wherein, use the MODBUS bus to carry out communication between host computer and the slave computer, host computer is as the bus host node, slave computer as bus from node, the slave computer external sensor;
The interface alternation module is arranged in host computer, is used for man-machine interaction, sends the instruction that sensor is demarcated or programmed to slave computer through host computer;
Flush bonding module is arranged in slave computer, carries out the instruction of said demarcation or programming, sensor is demarcated or is programmed through slave computer;
Said sensor is a dynamoelectric accelerograph pedal Hall element;
Said demarcation comprises one or more in voltage and location position, Zero calibration and the maximal value demarcation; Said voltage and position calibration, i.e. this corresponding sensor output voltage of dynamoelectric accelerograph pedal travel present position; Said Zero calibration, when promptly gas pedal was not operated in position, this sensor output voltage was 0V; Said maximal value is demarcated, and when promptly gas pedal was stepped on maximum position, this sensor output voltage was the maximal value of this sensor output voltage.
The invention has the beneficial effects as follows:
(1) the present invention is the instrument that the Hall element TLE4997 of Infineon is demarcated and programmes, and demarcates easily and fast and programming process for the user of this sensor provides.
(2) flush bonding module of the present invention can be measured through position and output voltage to sensor, thereby calculates the side-play amount and the gain of sensor, and sensor is demarcated.
(3) pass through the MODBUS communication between host computer of the present invention and the slave computer; Can demarcate sensor through the flush bonding module that the interface alternation module on the PC host computer is observed on parameter value and the control slave computer; And parameter value write sensor, very easy to use.
(4) the present invention can also carry out temperature compensation to the output of sensor from the consideration that temperature can impact magnetic field intensity.
Embodiment
As shown in Figure 1, transducer calibration of the present invention and programming tool one embodiment mainly comprise: host computer and interface alternation module are the slave computer and the flush bonding module of its processing core with the single-chip microcomputer.
Wherein, host computer adopts PC to get final product, and uses the MODBUS bus to carry out communication between host computer and the slave computer; Host computer is as the bus host node, and from node, host computer is through write command as bus for slave computer; Revise the value of slave computer MODBUS register, realize control slave computer; Equally, through to the reading of slave computer register, read the data of hope.
Slave computer external sensor--the Hall element TLE4997 of Infineon.TLE4997 designs for satisfying highly accurate corner, position measurement and precise current measurement specially.Its measuring principle is based on Hall effect.Because voltage is directly proportional with magnetic field intensity, so this element is through measuring the variation of magnetic field intensity, produce the voltage output that is directly proportional with magnetic field intensity.Because corner, position and change in current all can cause the variation in magnetic field, TLE4977 measures through this principle just that corner, position and electric current change.
The interface alternation module is arranged in host computer, is used for man-machine interaction, sends the instruction that sensor is demarcated or programmed to slave computer through host computer.Flush bonding module is arranged in slave computer, carries out the instruction of said demarcation or programming, sensor is demarcated or is programmed through slave computer.
The slave computer of present embodiment is an its processing core with 16 single-chip microcomputers of Infineon, mainly is responsible for following task:
1) pick-up transducers operate as normal output
2) read sensor parameter
3) accept the host computer order, sensor is programmed
4) to the host computer feedback data.
As shown in Figure 2, the hardware designs of the slave computer of present embodiment can be divided into following components according to its function: system power supply, single-chip minimum system circuit, sensor signal sample circuit, sensor communicating circuit and MODBUS communicating circuit.
Usually, distortion can take place during near 0v at output voltage in the operational amplifier of single power supply, in order to guarantee operational amplifier that the present invention uses outputting communication signal correctly, thereby makes the information transmit-receive of sensor accurate.The system power supply of slave computer of the present invention has partly adopted the design (see figure 3) of the operational amplifier of dual power supply, and amplifier has partly been used the 24v dual power supply, and digital circuit partly exceeds 3v than amplifier ground; And adopt 4n38 to realize the isolation of digital circuit and mimic channel, and like this, both guaranteed the output accuracy of operational amplification circuit, guaranteed the control of digital circuit again to operational amplification circuit; Be positioned at switch and optocoupler collaborative work on the amplifier negative feedback loop; Can realize the both-way communication of programmable device and sensor: when the output of CTRL1A control amplifier is opened; During the CTRL1T conducting; Amplifier will be amplified output from the signal of DA chip, and circuit just is operated in the pattern of external output signal; When amplifier output is closed, CTRL1T breaks off constantly, and circuit just switches to the pattern to the sampling of external input signal.
In addition, the power supply input as single-chip microcomputer and DA chip needs an accurate 5v voltage.Therefore; The system power supply part of slave computer of the present invention has also adopted the combination of max6043+tle4251; Max6043 is high-precision Voltage Reference, and 4251 are high-precision voltage followers, and the output current maximum can reach 800ma; Such power circuit has had both the characteristics of high precision and high driving ability.(see figure 4).
The single-chip minimum system circuit of slave computer is made up of power unit, external crystal-controlled oscillation, startup configuration and on-line debugging interface.Sensor communicating circuit aspect, transducer calibration and programming tool need can be for sensor provides 5V power supply, to guarantee its ability operate as normal.So we have used digital-to-analog to transform the scheme of chip (TLV5637)+operational amplifier (DPA547).The MODBUS bus protocol is based on the RS232 serial communication interface of standard, and MODBUS communicating circuit circuit designs based on serial communication transceiver (MAX232).
Flush bonding module on the slave computer of present embodiment comprises: sampling and processing sub, and it carries out the AD sampling and handles operation sensor output voltage through the sensor signal sample circuit; The sensor communication module, it carries out the visit of transducer calibration or DLL through the sensor communicating circuit, and data read, the storage operation of checking data; The MODBUS communication module, it carries out the communication operation between slave computer and the host computer through the MODBUS communicating circuit.
As shown in Figure 5, present embodiment adopts the design of state machine to write the program of sensor communication module programming part, thereby has simplified the complex logic in the programming process.The state flow graph comprises three basic status: " the sensor PORT COM is closed ", " the sensor PORT COM is opened " and " carry out communication with sensor and carry out programming operation ".
Behind system's power-up initializing, default conditions are " the sensor PORT COM is closed ".At this moment, slave computer will instruct according to host computer, open the operation of sensor PORT COM.If the success of PORT COM opening operation, sensor will feed back one group of data that comprise the working sensor state to slave computer, and after receiving these group data, the state of state machine switches to " the sensor PORT COM is opened ".
After port was opened, slave computer will further obtain instruction from host computer.If instruction is the closed communication port, then slave computer will be abandoned the operation to sensor, and the state of state machine also will transfer " the sensor PORT COM is closed " to by " the sensor PORT COM is opened ".If host computer hopes to obtain sensing data, perhaps hope sensor is carried out programming operation, then state will switch to " carry out communication with sensor and carry out programming operation ".
Success gets into after " carry out communication with sensor and carry out programming operation " state, and slave computer is according to the instruction of host computer, can select the read sensor data or sensor is programmed.So " carry out communication with sensor and carry out programming operation " having comprised again three sub-state: " read sensor data ", " writing data " and " to the EEPROM programming " (see figure 6) to sensor.
For the data that read from sensor, will carry out parity checking.The EEPROM The data of TLE4997 sensor a kind of special parity check system.For each address of EEPROM (each row), carry out even parity check, promptly this address bits per inch must be even number according to sum.For satisfying the row verification, the most significant digit of each address is an even parity bit.For each row, odd column carries out odd, and even column carries out even parity check.For satisfying the row verification, first word in eeprom address space is used for the memory row check bit.
This a kind of special verification mode can be used for verifying whether the data that read from sensor are correct.If continuous three incorrect words of reading of data, slave computer is the closed communication port, the prompting host computer, and the sensor communication possibly have problems, and state is switched to " the sensor PORT COM is closed ".If the reading of data success, state will switch to " the sensor PORT COM is opened ".
For to the EEPROM programming, then will be introduced into " writing data " state like instruction to sensor.Accomplish after EEPROM corresponding address internal memory writes data, the programming operation that begins EEPROM.After the EEPROM programming operation was accomplished, in order to protect EEPROM, slave computer was also with the closure sensor communication interface, and prompting host computer programming operation finishes, and state is switched to " the sensor PORT COM is closed ".
As shown in Figure 7, after host computer provides sample command, slave computer will be opened the probe power supply, and the operational amplifier that simultaneously sensor output is connected is closed.Like this, will directly get into the input pin of the analog digital conversion chip of single-chip microcomputer from the voltage signal of sensor output.After processor sent the processing request, sampling and processing sub were accomplished conversion automatically and data storage are arrived in the appointment register.
In the present embodiment, need to demarcate the side-play amount and the gain of TLE4997 sensor output voltage.According to side-play amount and gain, just can calculate the voltage output of gas pedal in arbitrary position.As shown in Figure 8, when the present invention steps on bottommost (P1) in gas pedal, sampling voltage output value V1 at this moment.Pedal is not being applied any time spent (P0) of doing fully, sampling voltage output V0 at this moment.Then, utilize the computing unit of single-chip microcomputer to calculate gain and be k=(V1-V0)/(P1-P0), and side-play amount is b=V0.So, gas pedal is V=k*P+b in the output of arbitrary position.After the demarcation, will gain k and side-play amount b of the present invention deposits in the EEPROM of sensor, and behind the pedal of at every turn stepping on the throttle, sensor just can be read this two values automatically in EEPROM, thereby calculates the voltage output in arbitrary position.
In the present embodiment, the MODBUS bus is used for host computer transmission instruction and Data transmission between the slave computer host computer.In order to realize this purpose, worked out communications protocol based on the MODBUS data mode, see table 1.
Table 1 MODBUS data communication agreement.
In addition, used two elementary instructions of MODBUS: register write and register read.
Corresponding respectively frame is as shown in the table:
1) register read command frame
Byte 1 | Byte 2 | Byte 3 | Byte 4-byte 5 | Byte 6-byte 7 | Byte n+1, byte n+2 |
Slave addresses | Function code 03 | Data volume | The originating register address | Read register quantity | Error-checking code |
Table 2-1 register read command frame
2) register read is got
feedback frame
1 | Byte 2 | Byte 3 | Byte 4-byte n | Byte n+1, byte n+2 |
Slave addresses | Function code 03 | Data volume | Register data | Error-checking code |
Table 2-2 register read is got feedback frame
3) register write command frame
Byte 1 | Byte 2 | Byte 3 | Byte 4-byte 5 | Byte 6-byte 7 | Byte n+1, byte n+2 |
Slave addresses | Function code 06 | Data volume | Target register address | Write data | Error-checking code |
Table 2-3 register write command frame
4) register write feedback frame
Byte 1 | Byte 2 | Byte 3 | Byte 4-byte 5 | Byte 6-byte 7 | Byte n+1, byte n+2 |
Slave addresses | Function code 06 | Data volume | Target register address | Write data | Error-checking code |
Table 2-4 register write feedback frame
Wherein error-checking code has adopted redundant reflected code (CRC), comprises 2 bytes, i.e. 16 scale-of-two.The CRC sign indicating number is calculated by transmitting apparatus, and result of calculation invests the afterbody of transmission information.After receiving equipment receives data, at first calculate the CRC sign indicating number of the information that receives, result of calculation is compared with the data that receive.If both conform to, the information that expression receives is accurate.Otherwise,, show that then data make mistakes if both do not conform to.
The computing method of CRC sign indicating number are that presetting 16 bit registers earlier is 1 entirely, progressively handles per 8 bit data information again.The CRC check only needs to calculate with 8 bit data positions.Start bit and position of rest also comprise PB if any the words of PB, do not participate in the CRC yardage and calculate.
When calculating the CRC sign indicating number, the data of 8 bit data positions and register are XOR mutually, and the result who obtains fills up most significant digit to low bit shift one byte with 0.Reexamine lowest order, if lowest order is 1, the content of register with preset several XORs mutually, if lowest order is 0, do not carry out XOR.
This process repeats 8 times always.After the 8th displacement, next 8 again with the content of present register XOR mutually, this process and above the same the repetition 8 times.After all processing data information were intact, the content of last register was the CRC code value.Low byte is preceding when the data transmission in the CRC sign indicating number, reception.
On implementation method, this subprogram drives through interrupt mode.In the reception of slave computer and send interrupt in judgement need carry out write operation or read operation.
The PC host computer of present embodiment can be used for that gas pedal dispatches from the factory that initialization is demarcated or causes wearing and tearing and demarcation again after the data-bias long-term the use.The user only need press the several buttons on the interface alternation module on the PC host computer, and slave computer just can be sampled to the voltage output of Hall element according to the instruction that host computer sends automatically, calculates and demarcates, and is very easy to use.
Present embodiment interface alternation modular program part can be passed through the VB language, and this module specifically comprises: display sub-module, and it is used for dynamically showing the magnitude of voltage of the sensor output that obtains through sampling and processing sub; Submodule is set, and it goes to be provided with the transducer calibration parameter through the sensor communication module or sensor is programmed; Calculating sub module is used for the calculating sensor calibrating parameters; Controlling sub, it is used for slave computer is sent various operational orders.
These interface alternation module concrete operations are following: after connecting necessary hardware equipment, click " connection " button at interface alternation module master interface.Click " opening " option under the main interface " power switch ", promptly open probe power, the state of right side, main interface two sensors A, B becomes green at this moment, shows that communication is normal.
Before demarcating; Present embodiment need be set the parameters in series of two sensors self according to different clients' actual demand; Wherein the high and low point of clamper has limited the bound of voltage setting and sampling; The magnetic field intensity scope then as its name suggests, the setting of low pass filtered frequency then is in order to reduce the interference of high frequency noise, the setting of three temperature parameter TR, TL, TQ is to float the influence to demarcating in order to reduce temperature.The parameter value that has provided on the present embodiment interface alternation module master interface can be used as a kind of reference frame.
After above-mentioned relevant parameters has been set; Carry out the sampling of two nominal data point magnetic field intensitys; Wherein first nominal data point is under the situation that pedal is not stepped on, to obtain, and second nominal data point then is at the situation down-sampling of pedal being stepped on extreme position.Like this, button click " calculating calibration value " can calculate the sensitivity and the side-play amount of two sensors according to the two nominal datas point that sampling is obtained.
After accomplishing demarcation, present embodiment writes calibration value in the sensor and goes, and promptly clicks " storage data " button on the main interface, postpones slightly, and sensor programming LED flavescence begins sensor is programmed.Sensor power supply LED and sensor programming LED extinguished simultaneously after programming was accomplished in short-term, and main interface is " pass " to the sensor power supply state, and ejected " sensors A, all successes of B storage data " prompt window.Notice on the main interface that there is " reading of data " button on the left side in the frame of the lower right corner, its effect is to read the calibration value of last stored in the sensor.As for a little bigger slightly " latch data " button of lower right corner font; In the process to sensor programming study and debugging is out of use, because carry out after it, sensor promptly is locked; Can't programme once more, general final step as exploitation special electronic gas pedal is carried out.
After demarcation finishes; Can be to the magnitude of voltage of stepping on the output of the capable omnidistance sampling two sensors of shift-in of pedal; After promptly restarting probe power; Click " continuous sampling " button in the middle of the lower right corner on the main interface, be equipped with stepping on of gas pedal and move past journey, the magnitude of voltage of two sensors output will be drawn on " continuous sampling " interface with the form of curve.
Present embodiment can also be provided with the temperature compensation submodule temperature compensation is carried out in the output of sensor from the consideration that temperature can impact magnetic field intensity.
The above is merely preferred embodiment of the present invention, not in order to restriction the present invention, all any modifications of within spirit of the present invention and principle, being made, is equal to and replaces and improvement etc., all should be included within protection scope of the present invention.