Self-alignment AD converter and AD conversion methodTechnical field
The present invention relates to a kind of AD converter, especially relate to a kind of can self-alignment AD converter, and realize self-alignment AD conversion method.
Background technology
Usually on Medical Devices, industrial control equipment, all can use ADC (analog to digital converter or AD converter), the information (for example information such as height, angle) of the parts form with numeral is shown.But, ADC ubiquity zero point error and gain error, cause final demonstration result and actual conditions deviation to some extent, sometimes even can cause accident, for support equipment normally uses, the ADC zero deviation and the gain deviation that all need this equipment manually is set before every equipment dispatches from the factory are calibrated, and also need after dispatching from the factory regularly to check to calibrate to reset.
The ADC device can be converted to value corresponding (the ADC maximum of 12bit is 4095) to the magnitude of voltage that represents certain physical quantity.ADC output 3900 when for example highly being 100cm, ADC output 50 when highly being 0cm, linear relationship (linearity error is not in limit of consideration of the present invention) K=(3900-50)/100=38.5 according to both is that AD output does not change 38.5 height change 1cm, 1 height change 0.028cm of the every variation of AD value in like manner then.Be not equal to 0 then zero point error has taken place explanation AD if the AD value is the height of output in 50 o'clock, show when in like manner actual height is for 100cm gain error has been taken place for explanation then.
Common AD calibration process is as follows: at first will need the variable calibrated to force to adjust to zero point (for example highly be 0 position), and manually import the actual value (for example 0) of current variable this moment; Second step will need the variable calibrated to force to adjust to maximum (for example highly be 100 position), manually import the actual value (for example 100) of current variable this moment again.Because the otherness of every equipment is so not quite identical every the equipment of deviation all needs the above step of repetition.After dispatching from the factory, the zero point error of ADC device and gain error also can change along with environmental change and passage of time, therefore regularly need repeat above step and calibrate.
Existing ADC calibration process is loaded down with trivial details, workload is big, and efficient is low, needs the artificial risk that participates in having introduced simultaneously.
Summary of the invention
The present invention propose a kind of can self-alignment AD converter and AD calibration steps thereof, exist when the calibration and take time and effort and inefficient technical problem to solve present AD converter.
The present invention adopts following technical scheme to realize: a kind of self-alignment AD converter, and it comprises: the AD circuit; Memory is used for storing two magnitudes of voltage of AD converting objects correspondence when two different physical quantities; Controller, be used for according to two magnitudes of voltage of nonvolatile memory, calculate the physical quantity of definite AD converting objects and the linear relationship between the magnitude of voltage, and according to linear relationship the transformation result of AD circuit is calibrated, wherein, this controller connects AD circuit and memory.
Wherein, described memory is nonvolatile memory, such as, described nonvolatile memory is the Flash memory.
In addition, the present invention discloses a kind of self-alignment AD conversion, and it comprises following performing step:
Determine the physical quantity of AD converting objects and the linear relationship between the corresponding voltage value;
Judge whether the magnitude of voltage of measuring under the current physical quantity exists deviation, if exist deviation, controller to carry out AD conversion calibration automatically.
Wherein, the step of determining described linear relationship comprises:
Represent the position of two different physical quantities in the AD converting objects, two position-sensing switches are set respectively;
When triggering two position-sensing switches respectively, measure two magnitudes of voltage of two physical quantity correspondences;
Can calculate the physical quantity of definite AD converting objects and the linear relationship between the corresponding voltage value by controller according to these two voltage datas.
Wherein, the step of determining described linear relationship also comprises: described two magnitudes of voltage are retained in the memory.
Wherein, the described controller step of carrying out AD conversion calibration automatically comprises:
Controller calculates current physical quantity corresponding voltage value according to described linear relationship;
The magnitude of voltage that calculates is covered the magnitude of voltage of measuring under the current physical quantity.
Compared with prior art, the present invention has following beneficial effect:
The present invention comes by maximum and the minimum value position placement positioning switch that needs measure physical quantities in equipment, realizes this measure physical quantities is carried out the automatic calibration of the AD converter of AD conversion, thereby has avoided workman's calibration, has improved operating efficiency.In addition, the present invention has simple in structure, realizes the low advantage of cost.
Description of drawings
Fig. 1 is the structural representation of the AD converter that proposes of the present invention.
Fig. 2 is that the present invention carries out the AD conversion schematic flow sheet of calibration automatically.
Embodiment
As shown in Figure 1, the AD converter of the present invention's proposition comprises: the AD circuit; The controller that is connected with the AD circuit; The memory that is connected with controller.Wherein, nonvolatile memory has been used for storing two different physical quantities corresponding voltage value that the AD circuit carries out AD converting objects (such as height, length); Controller is used for according to two different magnitudes of voltage of nonvolatile memory, calculates the physical quantity of AD converting objects and the linear relationship between the magnitude of voltage, according to linear relationship the transformation result of AD circuit is calibrated.
In a preferred embodiment, memory is nonvolatile memory, such as the Flash memory.
Wherein, two different pieces of informations that the AD circuit carries out the AD converting objects have been stored in the nonvolatile memory: highly being example, place two position-sensing switches respectively at maximum 100cm and minimum value 0cm place, then represent current height value when the position-sensing switch at component triggers maximum place and reach maximum, simultaneously controller receive after the switching signal will this moment the AD value record to nonvolatile memory, the AD value record in the time of equally also can obtaining the minimum value 0cm of this equipment is to nonvolatile memory.
After obtaining these two data, controller can be calculated any some positions in the range according to linear relationship, in case new deviation occurs, the value covering that controller can automatically will be new is original in the follow-up operation, and be stored in the nonvolatile memory, even power down can not lost yet.Every equipment is as long as guarantee that the position is accurate when position-sensing switch is installed like this, just need be at manually input value, and follow-uply also need not frequently manual calibration, thus improved efficient greatly, reduced risk.
In conjunction with shown in Figure 2, the present invention proposes a kind of self-alignment AD conversion method, and it comprises following performing step:
Step S1, the physical quantity of determining AD converting objects (for example height, angle etc.) and the linear relationship between the corresponding voltage value.
Specifically, step S1 is the position that represents two different physical quantities in the AD converting objects, two position-sensing switches are set respectively, when triggering two position-sensing switches, measure the magnitude of voltage of corresponding physical quantity respectively, obtain two voltage datas, and these two voltage datas are remained in the nonvolatile memory; Then, controller can calculate the physical quantity of definite AD converting objects and the linear relationship between the corresponding voltage value according to these two voltage datas.
Step S2, according to described linear relationship, judge whether the magnitude of voltage of measuring under the current physical quantity exists deviation.
Step S3, if exist deviation, controller to carry out AD conversion calibration automatically.Such as, calculate current physical quantity corresponding voltage value according to described linear relationship, the magnitude of voltage that calculates is covered the magnitude of voltage of measuring, thereby can guarantee the accuracy of AD conversion.
Use the present invention, improved the operating efficiency of producers' AD calibrations in commissioning device, avoided manual input operation, reduced the workload of later maintenance simultaneously.
The above only is preferred embodiment of the present invention, not in order to limiting the present invention, all any modifications of doing within the spirit and principles in the present invention, is equal to and replaces and improvement etc., all should be included within protection scope of the present invention.