Summary of the invention
Technical matters to be solved by this invention is to provide a kind of precision height and can realizes the resistance output instrument of multiple-channel output and export the method for different resistance values.The technical matters that the present invention also will solve be to provide a kind of precision high, use stable test macro.
In order to solve the problems of the technologies described above, the technical solution used in the present invention is:
A kind of resistance output instrument, comprising:
Single-chip microcomputer, it is for the treatment of data;
Impact damper, it is for storing data;
Resistance adjustment unit, it is for exporting different resistance values;
Described single-chip microcomputer, described impact damper and described resistance adjustment unit are connected successively.
Preferably, described resistance adjustment unit, comprising:
Multiple resistive element, it is connected successively;
Multiple light coupling relay, each described light coupling relay is corresponding with a described resistive element, the resistive element parallel connection that each described light coupling relay is corresponding with it;
Described light coupling relay is connected with described impact damper.Its method exporting different resistance values of this resistance output instrument is as follows:
1) will the resistance value exported be needed to be set as r;
2) resistance of resistive element in resistance output instrument is set as R respectively
i, i=1,2,3 ... n;
3) with r successively divided by R
i, when r is divided by R
ibusiness when being 1, remainder is preserved and assignment to M, R
icorresponding light coupling relay disconnects;
4) A=R
i+1, B=M/A, as B=1, preserves remainder assignment to M, R
i+1corresponding light coupling relay disconnects;
5) step 4 is repeated), until during M=0, enter next step;
6) by the control of single-chip microcomputer, the resistance value sum of the resistive element corresponding to the light coupling relay be under off-state exported, described resistance value sum is setting resistance value r.
Preferably, described resistive element is chromatic circle resistance.
Preferably, described single-chip microcomputer, described impact damper, described light coupling relay and described chromatic circle resistance are integrated on one piece of circuit board.
A kind of test macro, comprising: the resistance output instrument as described in above-mentioned any one, computing machine and CAN interface module, described computing machine, described CAN interface module and described resistance output instrument are connected successively.
Preferably, described computing machine is industrial computer.
Preferably, described CAN interface module is CAN board.
A kind of resistance output instrument of the present invention comprises single-chip microcomputer, impact damper and the resistance adjustment unit of connecting successively, can be realized the accurate output of resistance value, and can guarantee the stability of output resistance by the control of single-chip microcomputer, can also realize the output of the different resistance of multichannel.A kind of test macro of the present invention comprises computing machine, CAN interface module and the above-mentioned resistance output instrument of connecting successively, can be used for testing automobile combination instrument etc. needs input different resistance values to carry out the parts tested, this test macro is measured precisely, and can actual condition be simulated, it is more convenient to operate.
Embodiment
Below in conjunction with the drawings and specific embodiments, the present invention is described in further detail:
As shown in Figure 1, a kind of resistance output instrument comprises single-chip microcomputer 1, impact damper 2 and the resistance adjustment unit 3 of connecting successively.Wherein, single-chip microcomputer 1 is for the treatment of data, and impact damper 2 is for storing data, and resistance adjustment unit 3 is for exporting different resistance values.As shown in Figure 3, preferably, resistance adjustment unit 3 comprises multiple resistive element and multiple light coupling relay, and above-mentioned resistive element is connected successively, and this resistive element preferred color of choice loop resistance, chromatic circle resistance is convenient to selection and resistance value is very clear.Resistive element also can select wire-wound resistor etc. except selecting chromatic circle resistance.Each light coupling relay is corresponding with a resistive element, the resistive element parallel connection that each light coupling relay is corresponding with it, and then light coupling relay is connected with impact damper 2 again.Further preferably, above-mentioned single-chip microcomputer 1, impact damper 2, light coupling relay and chromatic circle resistance are integrated on one piece of circuit board, thus by resistance output instrument modularization, can improve the integrated level of resistance output instrument.Resistance adjustment unit 3 also can adopt different potentiometers to coordinate with light coupling relay except adopting said structure.
In the present embodiment, resistive element and light coupling relay are 20, and 20 resistive elements are arranged in order according to the size of resistance, and four resistive elements are one group, are divided into five groups, and the resistance of each group is respectively:
R
1-R
4:50KΩ、20KΩ、20KΩ、10KΩ;
R
5-R
8:5KΩ、2KΩ、2KΩ、1KΩ;
R
9-R
12:500Ω、200Ω、200Ω、100Ω;
R
13-R
16:50Ω、20Ω、20Ω、10Ω;
R
17-R
20:5Ω、2Ω、2Ω、1Ω。
The light coupling relay that each resistive element is corresponding with it is in parallel, with R
1-R
8corresponding light coupling relay is connected with the first impact damper 2a, this first impact damper 2a again with the D on single-chip microcomputer
01-D
08pin serial connection.With R
9-R
16corresponding light coupling relay is connected with the second impact damper 2b, this second impact damper 2b again with the D on single-chip microcomputer 1
09-D
16pin serial connection.With R
17-R
20corresponding light coupling relay is connected with the 3rd impact damper 2c, the 3rd impact damper 2c again with the D on single-chip microcomputer 1
17-D
20pin serial connection.Total output area of this resistance output instrument is 1 Ω-110K Ω, precision 1 Ω, through actual measurement, the resistance value of output linearly, continuously and stable, as shown in Figure 4.
Above-mentioned resistance output instrument, its method exporting different resistance values is as follows:
1) will the resistance value exported be needed to be set as r;
2) resistance of resistive element is set as R respectively
i, i=1,2,3 ... n;
3) with r successively divided by R
i, when r is divided by R
ibusiness when being 1, remainder is preserved and assignment to M, R
icorresponding light coupling relay disconnects;
4) A=R
i+1, B=M/A, as B=1, preserves remainder assignment to M, R
i+1corresponding light coupling relay disconnects;
5) step 4 is repeated), until during M=0, enter next step;
6) single-chip microcomputer exports control signal, and the resistance value sum of the resistive element corresponding to the light coupling relay be under off-state exported, resistance value sum is setting resistance value r.
Suppose the resistance value r=80 Ω needing to export, R
1-R
20resistance as previously shown.
First, by 80 from R
1start to be divided by successively, find with 80 divided by R
1-R
12business be 0, so R
1-R
12corresponding light coupling relay all maintains closure state.
Work as r/R
13time, be 80/50, business is 1, and remainder is 30, i.e. M=30, then R
13corresponding light coupling relay disconnects;
Now A=R
14(because of R in previous step
ifor R
13, so, R
i+1for R
14, i.e. A=R
14), B=M/A=30/20=1 ... 10, namely business is 1, and remainder is 10, then M=10, R
14corresponding light coupling relay disconnects;
Now A=R
15(because of R in previous step
ito increase progressively as R
14, so, R in this step
i+1increase progressively as R
15, i.e. A=R
15), B=M/A=10/20=0 ... 10, namely business is 0, and remainder is 10, then the M value of giving is still in previous step 10, i.e. M=10, R
15corresponding light coupling relay still keeps closure state;
Now A=R
16(because of R in previous step
ito increase progressively as R
15, so, R in this step
i+1increase progressively as R
16, i.e. A=R
16), B=M/A=10/10=1 ... 0, namely business is 1, and remainder is 0, then M=0, R
16corresponding light coupling relay disconnects;
Now M=0, enters next step;
Single-chip microcomputer exports control signal, exports, the resistance value sum of the resistive element corresponding to the light coupling relay be under off-state by R
13, R
14and R
16resistance sum export, resistance value sum be setting resistance value r, r=80, R
13+ R
14+ R
16=50+20+10=80, thus the output achieving 80 Ω resistance.
Above-mentioned resistance output instrument comprises single-chip microcomputer 1, impact damper 2 and the resistance adjustment unit 3 of connecting successively, can be realized the accurate output of resistance value, and can guarantee the stability of output resistance by the control of single-chip microcomputer 1, can also realize the output of the different resistance of multichannel.
As shown in Figure 2, a kind of test macro comprises aforementioned resistance output instrument, computing machine 4 and CAN interface module, and resistance output instrument, computing machine 4 and CAN interface module are connected successively.Preferably, computing machine 4 is industrial computer, because industrial computer has better antidetonation and jamproof ability, therefore, is more suitable for industry spot.CAN interface module is CAN board 5, and select CAN board to be convenient to purchase on the one hand, board structure integrated level is high on the other hand, takes up room little.During use, resistance output instrument in this test macro is connected with tested parts, thus achieves the detection needing to input the parts that different resistance values is tested to such as automobile combination meter etc., and this test macro is measured precisely, and can actual condition be simulated, it is more convenient to operate.
Tester is according to different setting resistance values, call industrial computer and resistance output instrument carries out CAN communication, export the setting resistance signal value that needs to tested parts, separately using the parameter one of of setting resistance value as Labview program, actual Work condition analogue can be realized.Such as: this actual condition of fuel tank leakage of oil, resistance value is increasing progressively with non-linear, at this moment can using setting output resistance as one of Labview program parameter, it is programmed, make the resistance value exported at certain hour with linear or non-linear increasing, the leakage of oil operating mode that simulation is actual.
In sum, content of the present invention is not limited in the above-described embodiments, and those skilled in the art can propose other embodiment easily according to guiding theory of the present invention, and these embodiments all comprise within the scope of the present invention.