毕业设计(论文)
基于51单片机的双精度电子称设计
系 别 专业名称 班级学号 学生姓名 指导教师
自动化工程系 测控技术与仪器
5080930 靳姗 齐世清
2012年6月15日
基于51单片机的双精度电子称设计
摘 要
随着数字化技术的快速发展和应用,电子衡器称重技术同样也得到了广泛的发展和应用,各种数字化智能化的电子衡器逐渐问世,但商用电子称作为电子衡器的重要一部分,在中小型市场的智能化并没有得到普及,依然以杆秤、台秤和简易电子称为主的商用电子秤,存在着精度差、易损坏、难维修等缺陷,尤其是在进行轻微物体如茶叶、药材等的测量时误差更明显。
本文设计的双精度电子称主要以AT89S52单片机为核心,通过Proteus软件和KEIL软件实现了对电子称的功能仿真设计。主要分为五个模块:双精度的物体重量采集模块、单片机处理模块、键盘控制模块、数据显示模块以及软件驱动模块。以不同压力传感器采集压力参数,经过信号处理和A/D转换送给单片机,单片机通过重量参数自动选择12位精度值或8位精度值进行运算处理,最终将键盘输入的单价值和总价值在LCD12864液晶上进行实时显示。整个电子称系统能够智能化的实现双精度自动测量、自动报警、直观显示等功能,具有操作方便,双精度测量准确,成本低、稳定性可靠性高等特点,可以更好的应用于不同的应用场合,适应了中小型市场的需求。 关键词:双精度电子称,单片机 AT89S52,称重传感器,A/D转换,液晶显示器
Said design based on 51 single-chip double-precision electronic
Author:Jin Shan
Tutor:Qi Shiqing
Abstract
With the rapid development and application of digital technology, electronic weighing technology has been developed and applied extensively .And a variety of intelligent digital electronic weighing is emerging progressively, but in small and middle market, the commercial electronics, which is an important part of the electronic weighing, is still limited to the simple electronics said such as steelyard, platform scales and simple electronics. All these are known as the main commercial electronic scales, but the existence of accuracy, easily damage, and difficult to repair defects also affect itself. Especially during weighing some minor objects such as tea, medicinal herbs, mistakes is easy to appearance through measuring. This paper, the design of the double-precision electronic using microcontroller AT89S52 as the core, achieve the simulation capabilities of electronic design by using Proteus Software and KEIL software. Now dividing this paper into five main modules: how to collect the weight of the object with this double-precision electronic said module, how to deal with the data through single-chip machine, how to control keyboard module, the display module and how to drive software module. Fristly, use different pressure sensor to acquire pressure parameters. Secondly the signal processor and A / D conversion work out the data, finally given to the MCU. Thridly according to the data above the MCU will automatically select whether the 12 precision values or 8 precision value computing processor. Ultimately the input through the keyboard will be showed on the LCD12864 real-time display. The entire electronic system can intelligently accomplish double-precision measurement automatically, automatic alarm, visual display, at the same time, it’s easy to operate, accurate measurement, low cost, stability and high reliability. Based on the introduction above ,it can be used in different applications occasions, and it can adapt to the needs of small and medium-sized market.
Key Words: Double-precision electronic, AT89S52, Load sensor, A/D converter, LCD
display
目 录
1 绪论 ..................................................................................................................................... 3 1.1 课题研究背景 .............................................................................................................. 3 1.2 电子衡器的研究现状 .................................................................................................. 3 1.2.1 国内外发展情况 ................................................................................................. 4 1.2.2 电子称的发展方向 ............................................................................................. 4 1.3 课题的研究意义 .......................................................................................................... 5 1.4 本文的设计思路 .......................................................................................................... 5 2 系统方案论证与硬件选型 ................................................................................................. 8 2.1 系统总体设计方案的比较与论证 .............................................................................. 8 2.2 硬件方案设计与论证 ................................................................................................ 10 2.2.1 CPU的选择方案 .............................................................................................. 10 2.2.2 传感器的选择 ................................................................................................... 11 2.2.3 放大电路的选择方案 ....................................................................................... 12 2.2.4 A/D转换器的选择 ........................................................................................... 14 2.5 键盘处理部分方案的论证 ........................................................................................ 18 2.6 显示器部分的选择 .................................................................................................... 19 2.7 超量程报警部分的选择 ............................................................................................ 19 3 硬件电路设计 ................................................................................................................... 20 3.1 AT89S52单片机介绍 ............................................................................................... 20 3.1.1 AT89S52单片机综述 ....................................................................................... 20 3.1.2 AT89S52的最小系统电路构成 ....................................................................... 21 3.2 A/D转换器与AT89S52单片机接口电路............................................................... 22 3.3 显示电路与AT89S52单片机的接口电路 .............................................................. 24 3.3.1 12864点阵型LCD简介 .................................................................................. 25 3.3.2 点阵LCD的显示原理 ..................................................................................... 26
3.3.1 12864LCD指令系统 ........................................................................................ 27 3.4 键盘电路与AT89S52的接口电路设计 .................................................................. 29 4 系统软件设计 ................................................................................................................... 32 4.1 主程序设计 ................................................................................................................ 32 4.1.1 C语言在单片机中的应用 ............................................................................... 32 4.1.2 电子称的软件设计与实现 ............................................................................... 33 4.2 系统主程序流程图 .................................................................................................... 33 4.3 系统子程序设计 ........................................................................................................ 34 4.3.1 A/D转换启动及数据读取程序设计 ............................................................... 34 4.3.2 显示程序设计 ................................................................................................... 36 4.3.3 键盘输入控制程序设计 ................................................................................... 37 5 系统调试 ........................................................................................................................... 39 5.1 软件调试 .................................................................................................................... 39 5.2 故障分析与解决方案 ................................................................................................ 39 5.2.1 故障出现情况 ................................................................................................... 39 5.2.2 解决方案 ........................................................................................................... 40 5.3 功能测试 .................................................................................................................. 40 结论 ......................................................................................................................................... 41 致 谢 ................................................................................................................................. 42 参考文献 ................................................................................................................................. 43 附 录 ................................................................................................................................. 44 附录A ................................................................................................................................ 44 附录B ................................................................................................................................ 51 附录C ................................................................................................................................ 52