基于单片机的数字万用表的设计

2019-04-10 19:36

本科毕业设计

基于单片机的数字万用表的设计

摘 要

本设计是基于51单片机的数字万用表,可用于测量直流电压、直流电压及电阻,并使用1602液晶进行显示。本系统由分压电阻、分流电阻、电阻-电压变换电路、单片机最小系统、液晶显示器、报警器、模数转换器及等部分组成。本系统采用STC公司的89C52单片机作为主控芯片,PCF8591作为模数转换芯片。主控芯片与模数转换芯片之间使用I2C总线进行数据通讯,大大地简化了硬件线路,提高系统的稳定性及测量准确度。从电源获取的电压或电流信号,通过衰减电阻进行衰减后,进入模数转换器的模拟输入端,而待测电阻则通过电阻-电压变换电路,把阻值转化为电压值进行测量。模数转换器进行转换之后,得到的数字编码通过I2C总线送回单片机。单片机对数据进行一定的处理后,测量结果由1602液晶显示器负责输出。本次设计的数字万用表共分为6个档位,分别是2V电压、20V电压、200mA电流、2A电流、2kΩ电阻、20kΩ电阻,超出量程时会自动使用蜂鸣器进行报警提示。本系统程序执行周期耗时较短,保证了系统的响应速度。经

过初步调试,本系统能较准确的测量量程范围内的电压及电流值,误差范围均在8%以内,而电阻值测量的误差值稍大,误差范围在8.2%以内。另外,本文详细地介绍了89C52型单片机及PCF8591模数转换芯片的基本功能及性能特征,并叙述了数字万用表测量电压、电流及电阻的基本原理。

关键词:数字万用表 89C52单片机 模数转换

Digital Multi-meter Based on SCM

Luo Jiawei

(College of Engineering, South China Agricultural University, Guangzhou 510642, China) Abstract: This design is a digital multi-meter based on 51 SCM (Single-Chip Computer), which can be used to measure DC (Direct Current) voltage, DC voltage and resistance and displays with a 1602 LCD (Liquid Crystal Display). The system consists of dividing resistors, shunt resistors, the resistor-to-voltage converting circuit, the smallest SCM system, LCD, alarm, analog-to-digital converter and other components. The system uses STC's 89C52 SCM as the master chip and PCF8591 as the analog-to-digital conversion chip. They use the I2C bus to communicate with each other, which can largely simplify hardware circuits and improve the stability and accuracy of measurement. The system captures the voltage or current signal from a power supply and the signal will be attenuated by dividing resistors or shunt resistors, before

it entering to the analog input terminal of the analog-to-digital converter. Still, the value of resistors is measured is carried out by the resistor-to-voltage converting circuit where resistors' value will be transforming to voltage. After the analog-to-digital converter finishing transformation, it sends back the digital encoding data to SCM through I2C bus. Then, the SCM will process the data and output the results of measurement by a 1602 LCD. The design of digital multi-meter is divided into six stalls which are 2V voltage, 20V voltage, 200mA current, 2A current, 2k resistor and 20k resistor. The results of measurement will be outputted by 1602 LCD and the buzzer will automatically alarm when something out of range happened. The program execution cycle of this system takes less time to ensure that the response speed of the system. After initial debugging, the system can be accurately measure voltage and current value in the range, with the error range less than 8%, while measurement of resistance has a slightly larger error range, less than 8.2%. In addition, this paper also describes the basic functions and performance characteristics of the 89C52 SCM and the PCF8591 analog-to-digital conversion chip, as well as a description of the basic principles of digital multi-meter to measure voltage, current and resistors.

Key words: Digital Multi-meter 89C52SCM A/D conversion

目 录

1 前言 .......................................................................................................................................... 1 1.1 课题的提出 ........................................................................................................................... 1 1.2 研究的意义 ........................................................................................................................... 1 1.3 设计的任务 ........................................................................................................................... 1 2 总体方案确定 .......................................................................................................................... 1 2.1 方案比较及选择 ................................................................................................................... 1 2.1.1 模数转换芯片方案 ............................................................................................................ 1 2.1.2 显示器方案 ........................................................................................................................ 4 2.2 确定设计方案 ....................................................................................................................... 5 3 系统硬件分析及设计 .............................................................................................................. 5 3.1 数字万用表的基本原理 ....................................................................................................... 5 3.1.1 模数转换及显示电路原理 ................................................................................................ 5 3.1.2 多量程数字电压表原理 .................................................................................................... 6 3.1.3 多量程数字电流表原理 .................................................................................................... 6 3.1.4 电阻测量原理 .................................................................................................................... 7 3.2 硬件系统总体设计框图 ....................................................................................................... 8 3.3 硬件电路所用芯片及元件介绍 ........................................................................................... 8 3.3.1 STC的89C52型单片机 .................................................................................................... 8 3.3.2 PCF8591模数及数模转换芯片 ....................................................................................... 12 3.3.3 LCD1602液晶显示器 ...................................................................................................... 13 3.4 硬件电路设计 ..................................................................................................................... 14 3.4.1 电源部分 .......................................................................................................................... 14 3.4.2 电压衰减电路 .................................................................................................................. 14 3.4.3 电流衰减电路 .................................................................................................................. 15 3.4.4 电阻-电压变换电路......................................................................................................... 15 3.4.5 模数转换部分 .................................................................................................................. 16 3.4.6 报警提示部分 .................................................................................................................. 17 3.4.7 单片机最小系统 .............................................................................................................. 17

I

3.4.8 显示输出部分 .................................................................................................................. 18 3.4.9 开关及量程选择部分 ...................................................................................................... 18 3.4.10 整体硬件电路 ................................................................................................................ 19 3.5 电路工作过程描述 ............................................................................................................. 19 4 系统软件设计 ........................................................................................................................ 19 4.1 C语言概述 .......................................................................................................................... 19 4.2 软件设计思路 ..................................................................................................................... 19 4.3 程序流程图 ......................................................................................................................... 20 4.3.1 系统软件总流程图 .......................................................................................................... 20 4.3.2 电压测量流程图 .............................................................................................................. 20 4.3.3 电流测量流程图 .............................................................................................................. 21 4.3.4 电阻测量流程图 .............................................................................................................. 21 5 测试及实验分析 .................................................................................................................... 22 5.1 电路功能仿真 ..................................................................................................................... 22 5.1.1 数字电压表功能仿真 ...................................................................................................... 22 5.1.2 数字电流表功能仿真 ...................................................................................................... 23 5.1.3 数字欧姆表功能仿真 ...................................................................................................... 24 5.2 PCB布线图 ......................................................................................................................... 25 5.3 PCB制板成品图 ................................................................................................................. 25 5.4 成品外观 ............................................................................................................................. 25 5.5 测试数据 ............................................................................................................................. 26 5.5.1 直流电压测量数据 .......................................................................................................... 26 5.5.2 直流电流测量数据 .......................................................................................................... 27 5.5.3 电阻测量数据 .................................................................................................................. 27 6 结论 ........................................................................................................................................ 27 参 考 文 献 .............................................................................................................................. 29 附 录 .................................................................................................................................... 30 致 谢 .................................................................................................................................... 31 华南农业大学本科生毕业设计成绩评定表

II


基于单片机的数字万用表的设计.doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:母婴护理师(高级)课程笔试试卷一试卷

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: