Development of digital voltmeter for AT89C51 microcontroller, range 0~5V, proteus simulation, schematic diagram PCB and C program, etc.

Design requirements
1. Design a simple DC digital voltmeter with MCS-51 series microcontroller as the core device;
2. Voltage range: 0~5V;
3. Minimum resolution: 0.01V;
4. Fewer components and cost low, and the measurement accuracy and reliability are high;

System overview
This design is a digital voltmeter system realized on the basis of Atmel 51 microcontroller development platform and automatic control principle.

The system uses AT89C51 microcontroller as the control core and ADC0809 as the analog-to-digital conversion chip to realize the measured voltage data sampling in the range of 0 to 5V; LCD1602 character liquid crystal displays the measured voltage value.

At the same time, the measurement accuracy of the digital voltmeter is 0.01V, which can meet the general measurement requirements. The system framework is shown in the following figure.
insert image description here
Simulation circuit diagram
insert image description here
insert image description here
schematic diagram
insert image description here
PCB diagram
insert image description here
simulation result analysis
Open the Proteus simulation file, the file suffix is ​​DSN. Double-click the microcontroller, load the DianYa.hex file (located in the C program folder), and run the simulation, the result is shown in the following figure.
LCD display voltage value 1.84V
As can be seen from the figure, the LCD shows that the voltage of the AD conversion channel IN0 is 1.84V, and the result measured by the voltmeter (Volts) that comes with the Proteus software is 1.85V. There is an occasional deviation of 0.01V between the two, which belongs to Emulates normal behavior.

By clicking the red arrows up and down the sliding rheostat RP2, the change of the measured voltage value (between 0 and 5V) is simulated, and the LCD tracks and displays the change of the voltage in real time.

The picture below shows that after adjusting the sliding rheostat, the voltage value displayed by the LCD is 4.25V, which is consistent with the display result of the Volts voltmeter.
insert image description here
To sum up, the digital voltmeter Proteus simulation design operation effect meets the design requirements.

Part of the C code

#include"include.h"
#define TIME0H 0x3C
#define TIME0L 0xB0
uchar uc_Clock=0;		//定时器0中断计数
bit b_DATransform=0;

void vShowVoltage(uint uiNumber)
{
    
       
    
	uchar ucaNumber[3],ucCount;
	if(uiNumber>999)					
		uiNumber=999;
	ucaNumber[0]=uiNumber/100;								//把计算数字的每个位存入数组。
	ucaNumber[1]=(uiNumber-100*(int)ucaNumber[0])/10;							
	ucaNumber[2]=uiNumber-100*(int)ucaNumber[0]-10*ucaNumber[1];
	for(ucCount=0;ucCount<3;ucCount++)
	{
    
       
    
		vShowOneChar(ucaNumber[ucCount]+48);				//从首位到末位逐一输出。
		if(ucCount==0)
			vShowOneChar('.');
	}
}
void main()
{
    
       
    
	TMOD=0x01;			//定时器0,模式1。
	TH0=TIME0H;
	TL0=TIME0L;
	TR0=1;				//启动定时器。
	ET0=1;				//开定时器中断。
	EA=1;				//开总中断
	vdInitialize();
	vWriteCMD(0x84);	   //写入显示起始地址(第一行第4个位置)
	vShowChar("voltage");
	vWriteCMD(0xC9);     
	vShowChar("(V)");
	while(1)
	{
    
       
    
		if(b_DATransform==1)
		{
    
       
    
			b_DATransform=0;
			vWriteCMD(0xC4);
			vShowVoltage(uiADTransform());
		}
	}
}

shared content

(1) Full version of digital voltmeter design paper based on 51 MCU;
(2) C program;
(3) Proteus simulation file;
(4) Schematic and PCB file;
(5) Visio flow chart;
(6) Components list ;
(7) Reference materials;

The content is shown
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
in the figure. Important things are said again! ! !

Get a complete set of design materials for digital voltmeter design!

Please search on WeChat and follow my official account: Jiaoyuan Xiaozhi

Related Posts