Smart test
The design of pic16c57 single-chip resistance measuring instrument
Low-resistance measuring instruments can be divided into two categories according to the size of their test current: one type of test current is large, mainly used for the measurement of DC low resistance of connectors, switches, conductors and other products; It is about 1 mA), which is used to measure the DC low resistance of electric detonators, igniters or other dangerous and explosive occasions, connectors, switches and other components. Low-resistance measuring instruments have high requirements for safety performance, and a variety of protection circuits must be added; safety and reliability must also be considered when designing and wiring the PCB. Since 1989, we have continuously improved and perfected the circuit design and designed and produced 4 models of low resistance measuring instruments. The following is the ?DZC-4? intelligent low resistance measuring instrument.
As shown in Figure 2, a 4 1/2-bit ICL7135 chip is used and connected to the mode of a voltmeter with a full scale of 2 V. ICL7135 provides data to the microcontroller in the form of a 5-bit BCD code, and provides over-range (OV) and under-range (UN) signals to the microcontroller for automatic range switching. The clock frequency of ICL7135 comes from the Q5 terminal of T5 (CD4060). The frequency is 1.25 kHz, which is exactly an integer multiple of the power frequency of 50 Hz, which can improve the instrument's ability to resist power frequency interference. The A/D conversion frequency is approximately: 3.3 times/s. The COUT end of T5 also provides a 4MHz clock frequency to the microcontroller. ?
1 Overall plan and technical indicators
As shown in Figure 1, the instrument consists of 5 parts: power supply, precision constant current source, precision voltage amplifier, A/D converter, and single-chip controller.
Its main technical indicators are as follows:
Test range: 0~20Ω0~200Ω0~2 k (automatic switching of three ranges);
Resolution: 0.001;
Test current: 0.5 mA;
Test accuracy: ±(0.2%+2);
Power consumption of the whole machine: "30 mA.
2 Hardware design
(1) Power supply part?
The whole machine is powered by 6 AA Ni-MH batteries (7.2 V) and a universal DC/DC converter, which converts the battery voltage into a stable ±5 V DC voltage. This part also has a battery voltage monitoring circuit and a charging circuit, the battery is fully charged and the instrument can be used continuously for about 50 hours.
As shown in Figure 2, a 4 1/2-bit ICL7135 chip is used and connected to the mode of a voltmeter with a full scale of 2 V. ICL7135 provides data to the microcontroller in the form of a 5-bit BCD code, and provides over-range (OV) and under-range (UN) signals to the microcontroller for automatic range switching. The clock frequency of ICL7135 comes from the Q5 terminal of T5 (CD4060). The frequency is 1.25 kHz, which is exactly an integer multiple of the power frequency of 50 Hz, which can improve the instrument's ability to resist power frequency interference. The A/D conversion frequency is approximately: 3.3 times/s. The COUT end of T5 also provides a 4MHz clock frequency to the microcontroller. ?
(2) Constant current source?
is composed of a precision reference voltage source and a high-performance operational amplifier to provide a test current to the resistance under test. The test current is selected as 0.5mA.
Since the precision current source is the weak link of the safety performance of the entire instrument, various internal and external possible factors must be considered for damage to the instrument, thereby affecting the safety performance. Mainly adopted the following measures:
Limit current Use the constant current characteristic of junction FET to limit the size of test current ITEST, generally IDSS≈2*ITEST. In order to increase reliability, two FETs are connected in series.
The voltage limit uses a Zener diode in parallel with the test terminal to limit the voltage.
(3) Precision amplifier?
The in-phase amplification of the test signal is done by the chopper-stabilized operational amplifier, because the full-scale voltage of the A/D converter is 2 V, and the test current is 0.5 mA, corresponding to 20, 200, and 2K. The in-phase amplification of the three ranges is 200, 20 ,2. Connect two analog electronic switches SW1 and SW2 controlled by a single-chip microcomputer in the negative feedback loop, which are used to switch between 3 ranges with different magnifications: when the range is 20, W1 and SW2 are closed; when the range is 20, W1 and SW2 are both closed; when the range is 200, W1 is open; 2k 偈盨 W1, SW2 are both open. The instrument should be calibrated from the low range, otherwise it cannot calibrate all ranges. In addition, Ri, R1, R2, and R3 should use precision resistors and precision potentiometers to reduce the influence of temperature.
? (4) A/D converter?
As shown in Figure 2, a 4 1/2-bit ICL7135 chip is used and connected to the mode of a voltmeter with a full scale of 2 V. ICL7135 provides data to the microcontroller in the form of a 5-bit BCD code, and provides over-range (OV) and under-range (UN) signals to the microcontroller for automatic range switching. The clock frequency of ICL7135 comes from the Q5 terminal of T5 (CD4060). The frequency is 1.25 kHz, which is exactly an integer multiple of the power frequency of 50 Hz, which can improve the instrument's ability to resist power frequency interference. The A/D conversion frequency is approximately: 3.3 times/s. The COUT end of T5 also provides a 4MHz clock frequency to the microcontroller. ?
(5) Single-chip microcomputer controller?
The functions of this part include: data acquisition, processing, display, range switching, voltage monitoring, etc. The display module of this machine has two 74LS164s which are respectively used for bit drive and segment drive of LED digital tube, a total of 5 digital display, as shown in Figure 2.
As shown in Figure 2, a 4 1/2-bit ICL7135 chip is used and connected to the mode of a voltmeter with a full scale of 2 V. ICL7135 provides data to the microcontroller in the form of a 5-bit BCD code, and provides over-range (OV) and under-range (UN) signals to the microcontroller for automatic range switching. The clock frequency of ICL7135 comes from the Q5 terminal of T5 (CD4060). The frequency is 1.25 kHz, which is exactly an integer multiple of the power frequency of 50 Hz, which can improve the instrument's ability to resist power frequency interference. The A/D conversion frequency is approximately: 3.3 times/s. The COUT end of T5 also provides a 4MHz clock frequency to the microcontroller. ?
Pin 25 of T2 of the single-chip microcomputer is used to turn off the display of the display module, so as to prevent the digital tube from displaying garbled codes during data transmission. Pin 24 of T2 is the battery undervoltage detection input. Pins 23 and 22 of T2 control the analog electronic switch of the precision amplifier to generate the required magnification.
3 Software design
The characteristic of this instrument is to use software to realize automatic zero adjustment and range conversion, eliminating the need for potentiometers and range switching switches with higher failure rates. The method of software zero adjustment is: the microcontroller performs a self-check after booting, and if the system works normally, read the result of the A/D conversion. After reading 5 A/D conversion results continuously, judge whether they are all less than 0.2Ω, otherwise, it is considered that the operator has not reliably short-circuited the test rod, and the instrument continues to display the zero adjustment prompt. If 5 consecutive values are less than 0.2Ω, then find the value as the initial value, and subtract the initial value from each subsequent measurement result.
According to the over-range and under-range signals of the A/D conversion chip ICL7135, the single-chip microcomputer automatically switches the range. Range switching needs to complete three tasks: first, switching the magnification of the precision amplifier, then adjusting the effective digits of the initial value, and adjusting the position of the decimal point.
As shown in Figure 2, a 4 1/2-bit ICL7135 chip is used and connected to the mode of a voltmeter with a full scale of 2 V. ICL7135 provides data to the microcontroller in the form of a 5-bit BCD code, and provides over-range (OV) and under-range (UN) signals to the microcontroller for automatic range switching. The clock frequency of ICL7135 comes from the Q5 terminal of T5 (CD4060). The frequency is 1.25 kHz, which is exactly an integer multiple of the power frequency of 50 Hz, which can improve the instrument's ability to resist power frequency interference. The A/D conversion frequency is approximately: 3.3 times/s. The COUT end of T5 also provides a 4MHz clock frequency to the microcontroller. ?
PIC16C57 single-chip microcomputer has no interrupt function. It communicates with the A/D converter by query method, and uses the gap of A/D conversion to display data.
The PIC microcontroller and 74LS164 in the display module adopt serial data communication, and only display 1 bit of data at a time. In order to prevent the display from flickering, the refresh rate should be greater than 30Hz.
The program flow is shown in Figure 3.
4 Conclusion
The instrument and the measured resistance adopt a 4-wire connection method, which can eliminate the influence of connector resistance. In addition, due to the high resolution of the instrument, it is important to require the test fixture to be silver-plated, otherwise it will cause the test results to drift.
The test results of the instrument's mass production show that the technical indicators of the instrument meet the design requirements and can meet the needs of production and scientific research. If the instrument is slightly improved, it can be used as a highly sensitive DC voltmeter and ammeter.