当前位置:网站首页>AT89C51单片机的数字电压表开发,量程0~5V,proteus仿真,原理图PCB和C程序等
AT89C51单片机的数字电压表开发,量程0~5V,proteus仿真,原理图PCB和C程序等
2022-04-23 14:13:00 【蒋宇智】
设计要求
1.以MCS-51系列单片机为核心器件,设计一个简单的直流数字电压表;
2.电压量程:0~5V;
3.最小分辨率:0.01V;
4.所用元器件较少,成本低,且测量精度和可靠性较高;
系统概述
本设计是基于Atmel 51单片机开发平台和自动控制原理的基础上实现的一种数字电压表系统。
该系统采用AT89C51单片机作为控制核心,以ADC0809为模数转换芯片,实现量程0到5V的被测电压数据采样;LCD1602字符液晶显示被测电压值。
同时,数字电压表测量精度为0.01V,能够满足一般测量要求,系统框架如下图所示。
仿真电路图
原理图
PCB图
仿真结果分析
打开Proteus仿真文件,文件后缀名为DSN.双击单片机,加载DianYa.hex文件(位于C程序文件夹中),运行仿真,结果如下图所示。
图中可以看出,LCD显示AD转换通道IN0电压(Voltage)的大小为1.84V,用Proteus软件自带的电压表(Volts)测量的结果为1.85V,两者偶有0.01V的偏差,属于仿真正常现象。
通过点击滑动变阻器RP2上下红色箭头,模拟被测电压值的改变(0~5V之间),LCD实时跟踪显示电压的变化。
下图为调整滑动变阻器后,LCD显示的电压值为4.25V,与Volts电压表显示结果一致。
综上所述,数字电压表Proteus仿真设计运行效果满足设计要求。
部分C代码
#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());
}
}
}
分享的内容
(1)基于51单片机的数字电压表设计论文完整版;
(2)C程序;
(3)Proteus仿真文件;
(4)原理图及PCB文件;
(5)Visio流程图;
(6)元器件清单;
(7)参考资料;
内容如图
重要的事情说一遍!!!
获取数字电压表设计全套设计资料!
请微信搜索关注我的公众号:交院小智
版权声明
本文为[蒋宇智]所创,转载请带上原文链接,感谢
https://blog.csdn.net/JiaoDaBoy/article/details/115529187
边栏推荐
猜你喜欢
01-nio basic ByteBuffer and filechannel
Tongxin UOS uninstall php7 2.24, install php7 4.27 ; Uninstall and then install PHP 7.2.34
Qt实战:云曦日历篇
Man man notes and @ reboot usage of crontab
循环队列的基本操作,你学会了吗?
asp.net使用MailMessage发送邮件的方法
About the configuration and use of json5 in nodejs
API Gateway/API 网关(二) - Kong的使用 - 负载均衡Loadbalance
After entering the new company, the operation and maintenance engineer can understand the deployment of the system from the following items
Thread group ThreadGroup uses introduction + custom thread factory class to implement threadfactory interface
随机推荐
How does void * exist?
Notes on Visio drawing topology
Docker篇 (五) MySQL的安装
统信UOS PHP7.2.3升级至PHP7.2.24
如何轻松做好一个项目
Visio画拓扑图随记
dp-能量项链
1分钟看懂执行流程,永久掌握for循环(附for循环案例)
ansible及常用模块的使用
Docker (V) MySQL installation
Installation and use of postman pit
OpenSSH的升级、版本号的修改
After entering the new company, the operation and maintenance engineer can understand the deployment of the system from the following items
sar命令详解
Quickly understand the three ways of thread implementation
JS recursion (1)
C语言知识点精细详解——初识C语言【1】——你不能不知的VS2022调试技巧及代码实操【2】
flannel 原理 之 子网划分
Use the executors class to quickly create a thread pool
Introduction to loan market quotation interest rate (LPR) and loan benchmark interest rate