基于C8051F350的称重系统软件设计 下载本文

常州工学院毕业设计论文 摘 要

随着对称重仪表的准度、精度、速度的要求越来越高,快速发展的单片机被运用到其中并逐步形成了一套集称重、处理、显示、和监控的电子称重系统。本文介绍了电子称重系统的工作原理、硬件电路设计,重点介绍了软件设计。本系统在设计中紧密结合市场需求,参考了国内著名的称重仪器生产商的产品,并且在功能设计上进行了一些新的改进。本系统采用目前使用最广泛、技术较为成熟的SOC单片机C8051F350作为控制核心,实现了自动采样、处理、显示功能,并能通过异步串行口与上位机通信。其中测量功能由以MAVIN足立NA2型传感器为核心的传感器电路、以OPA27为核心的放大电路和单片机内部的24位A/D转换实现;显示电路采用LCD显示。整个系统具有精确、快捷、方便、实用的显著特点

关键词: 称重系统;C8051F350;传感器;A/D转换;LCD

I

常州工学院毕业设计论文 ABSTRACT

With the more and more higher request of the accuracy, precision and speed of weighing instrument, the singlechip with rapidly development is applied and a suit of electronic weighing system including weighing, processing, displaying and monitoring has been formed gradually. This text introduces the work principle, the hardware electronic circuit design, especially the software design of the electronic weighing system. During the process of design, the demand of market was especially noticed, many products of domestic famous weighing instrument producer were consulted and some new improvements were made on the function design. The system uses SOC SCM C8051F350 which is most extensively applied currently and relatively mature on techinique as the core of control, realizing the function of sampling, processing and displaying automatically, and can communicate with epigyny computer through the asynchronous serial port. Thereinto the measure is completed by sensor circuit based on MAVIN NA2 sensor, amplification circuit based on OPA227 and A/D converter in C8051F350, the LCD is applied in displaying circuit, which makes the whole system has the marked characteristics of precise, fast, convenience and applied.

Keyword: weighing system; C8051F350;Sensor;A/D conversion;LCD

II

常州工学院毕业设计论文 目 录

摘 要 ............................................................................................................................. I ABSTRACT .................................................................................................................. II 第一章 绪 论 .............................................................................................................. 1 1.1 课题来源 ............................................................................................................. 1 1.2 课题研究的目的和意义 ..................................................................................... 1 1.3 国内外现状 ......................................................................................................... 2 1.4 论文的主要内容 ................................................................................................. 2 第二章 设计要求 ........................................................................................................ 3 2.1总体要求 .............................................................................................................. 3 2.2性能指标 .............................................................................................................. 3 2.3本章小结 .............................................................................................................. 3 第三章 硬件设计 ........................................................................................................ 4 3.1 仪器功能简介 ..................................................................................................... 4 3.2 硬件设计 ............................................................................................................. 4 3.2.1系统原理框图 ............................................................................................... 4 3.2.2电路分析 ....................................................................................................... 4 3.3 本章小结 ........................................................................................................... 10 第四章 系统软件设计 .............................................................................................. 12 4.1主程序的设计 .................................................................................................... 12 4.2子程序的设计 .................................................................................................... 13 4.2.1时钟初始化子程序 ..................................................................................... 13 4.2.2 I/O端口初始化子程序 .............................................................................. 18 4.2.3 A/D转换初始化子程序 ............................................................................. 22 4.2.4 A/D转换子程序 ......................................................................................... 29 4.2.5显示子程序 ................................................................................................. 33 4.2.6异步串行口初始化子程序 ......................................................................... 40 4.2.7按键子程序 ................................................................................................. 44 4.3本章小结 ............................................................................................................ 45 第五章 软件仿真 ...................................................................................................... 46 5.1仿真软件的介绍 ................................................................................................ 46 5.2仿真画面的介绍 ................................................................................................ 46 5.3本章小结 ............................................................................................................ 50

III

常州工学院毕业设计论文 结 论 ........................................................................................................................ 51 参考文献 ...................................................................................................................... 52 致 谢 ........................................................................................................................ 54 附 录 ........................................................................................................................ 55

IV