Low-cost and high-precision A/D and D/A conversion design based on single chip microcomputer

At present, single-chip microcomputers have been widely used in electronic products. Many types of single-chip microcomputers have A/D conversion circuits inside, but such single-chip microcomputers will cost a few yuan or more in price than single-chip microcomputers without A/D conversion function. We provide a practical A/D conversion circuit realized by a common single-chip microcomputer. It only needs to use two I/O pins of an ordinary single-chip microcomputer and one operational amplifier, and it can be easily expanded to have 4 Channel A/D conversion function, because it occupies very little resources, has low cost, and its A/D conversion precision can reach 8 bits or higher, so it is very practical.

Its circuit is shown in Figure 1:

Figure 1

Its working principle is as follows:

1, hardware description:

In Figure 1, “RA0” and “RA1” are the two I/O pins of the MCU, which are set to the output and input states respectively. When A/D conversion is performed, PWM is generated by software in the program and sent by RA0 pin. The PWM waveform of the preset duty cycle. The RA1 pin is used to detect the state of the comparator output.

R1 and C1 form a filter circuit for smoothing the PWM waveform sent from the RA0 pin. The PWM waveform output by RA0 is filtered by R1 and C1 and delayed, and a stable voltage value is generated at U1. The voltage value U1=VDD*D1/(D1+D2), if the operating voltage of the MCU is stable +5V, Then U1=5V*D1/(D1+D2).

The LM324 in Figure 1 is used as a comparator. The U1 voltage at the input negative terminal is compared with the analog voltage value at the input positive terminal. When U1 is greater than the analog input voltage, the output of the comparator is low, and vice versa. level.

2, A / D conversion process:

If RA0 is outputted to the PWM waveform and its duty cycle changes gradually from small to large, the voltage of U1 will gradually change from small to large. When the U1 voltage exceeds the measured voltage, the output of the comparator changes from high level. Low level, so it can be considered that the analog quantity measured at the moment of the change is equal to the voltage of U1.

Since the voltage value of U1 = VDD * D1/ (D1 + D2), when VDD is fixed, its voltage value depends on the duty cycle of the PWM waveform, and the duty cycle of the PWM is used by the microcontroller software to control the PWM output. The value determines if the software uses an 8-bit register A to store the duty cycle value D1 of the PWM output of RA0. Therefore, when RA1 detects that the value of "1" is changed to "0", the value D1 of the A register is The A/D conversion value of the measured voltage has an A/D conversion result of 8 bits. If a 16-bit register is used as the duty cycle of the output PWM, the A/D conversion value can reach 16 bits.

Mobile Phone Battery is rechargeable Lithium Ion Battery for NOKIA,SAMSUNG and other phone brands.with its rechargeable ability and high energy desity, lithium ion battery is extensively applied in mobile phone and cell phone. with rich experience and advanced technology, our company supply battery for domestic and oversea clients. Please feel free to contact us!

Mobile Phone Battery For Nokia

Mobile Phone Battery For Nokia,Mobile Battery For Nokia,Cell Phone Battery,Rechargeable Batteries

Ji'an Powercome New Energy Technology Co., Ltd. , https://www.expowercome.com