Multi-range digital voltmeter based on 51 single chip microcomputer

1. Design requirements

With 51 single-chip microcomputer and A/D converter as the core, LCD1602-digit display, a multi-position DC voltage measurement circuit that can automatically select gears is designed. The measurable voltage range is 0V-500V. Voltage range: 2V, 20V, 200V and 500V, a total of four gears, the voltage range can be judged and the relay can be used to automatically switch the gears.

2. Design ideas and plans

(1) Digital-to-analog conversion circuit

The digital-to-analog conversion circuit is composed of ADC0808. ADC0808 is a CMOS device. It not only includes an 8-bit successive approximation ADC part, but also provides an 8-channel analog multiplexer and channel addressing logic, so there are reasons to use it as a simple "Data Acquisition System". Use it to directly input 8 single-ended analog signals time-sharing for A/D conversion.

①IN0~IN7——8 channels of analog input, through 3 address decoding lines ADDA, ADDB, ADDC to strobe one channel, respectively connected to P1.0, P1.1, P1.2 of the microcontroller. 

②D7~D0——The data output terminal after A/D conversion is three-state controllable output, so it can be directly connected with the microprocessor data line.

③VR(+), VR(-)——positive and negative reference voltage input terminals, used to provide the reference voltage of the on-chip DAC resistor network. In the case of unipolar input, VR(+)=5V, VR(-)=0V; in the case of bipolar input, VR(+) and VR(-) are respectively connected to positive and negative reference voltages

④ALE——Address latching permission signal, valid at high level. When this signal is valid, the A, B, and C three-bit address signals are latched, and the decoding strobe corresponds to the analog channel. When in use, this signal and START signal are connected together to latch the channel address and start A/D conversion at the same time.

⑤START——A/D conversion start signal, positive pulse is valid. The rising edge of the pulse applied to this end clears the successive approximation register, and the falling edge starts A/D conversion. If a new start pulse is received while the conversion is in progress, the original conversion process will be suspended and the conversion will restart from the beginning. 

⑥EOC——Conversion end signal, valid at high level. This signal is low level during the A/D conversion process and high level for the rest of the time. This signal can be used as a status signal queried by the CPU. Connect this signal to P3.0 to check whether the conversion is over.

⑦OE——output enable signal, high level is effective. When the microprocessor sends this signal, the output tri-state gate of ADC0808/0809 is opened, so that the conversion result can be read through the data bus.

 

(2) Voltage divider circuit

Because the voltage range to be measured is uncertain, the high can reach 500v, and AD can only refer to the input as +-5V, considering safety factors, so the voltage cannot be directly sent to ADC0808. For the unknown signal Vx, it is sent to the AD converter after being attenuated by the resistor divider. When processing data, multiply the conversion result by 1, 10, and 100 to restore the true value.

(3) Large voltage attenuation measurement: 

After judging by the single-chip microcomputer, it is necessary to operate the ABC pin of AD0808 to select the channel input. 

For 0-2V signal, select IN0 channel as input 

For 2-20V circuit, choose IN1 channel as input

For 20-200V circuit, select IN2 channel as input 

For more than 200V, select IN3 channel as input

 

The input signal passes through the above comparators and can be roughly divided into three ranges: 0-2V, 2-20V, 20V-200V, and above 200V, that is, it can be composed of four gears: 1 gear, 10 gear, 100 gear, and 1000 gear. Input the result of the comparator into the single-chip microcomputer for judgment processing.

The output of the comparator is: ①A=0, B=0, C=0, the voltage range is 0-2V.

②A=0, B=0, C=1, the voltage range is 2-20V. ③: A=0, B=1, C=1, the voltage range is 20-200V. ④: A=1, B=1, C=1, the voltage range is greater than 200V.

3. Hardware circuit

The information includes simulation schematics and programs, perfect simulation: https://www.cirmall.com/circuit/19756

For more MCU design and information, please pay attention to the WeChat public account "Electronic Engineer Growth Diary"! !

Guess you like

Origin blog.csdn.net/weixin_41017942/article/details/105440975