摘 要
本文介绍了一个多功能体重称设计,本设计以单片机为平台,利用金属应变片来感应人体的重量,传感器输出模拟量经 AD转换器转换成数字量传入单片机。利用超声波在介质中传播速度固定的原理可由超声波在空气中的传播时间算出传播距离,实现身高的测量。通过串口电路实现了单片机与上位机的通信。本设计硬件电路包括电源电路、单片机最小系统电路、液晶屏电路、串口通信电路、独立按键电路、蜂鸣器电路、超声波模块电路、AD转换器电路和全桥电路。软件部分包括主程序、系统初始化程序、AD转换器通信程序、按键检测程序、超声波信号发射及接收程序、液晶屏驱动程序。
整个设计系统由Atmel公司生产STC89C51单片机进行控制;软件实现功能开机检测,主要是开机后自动逐个扫描LED数码管,以防止某段数码管损坏造成视觉误差;出于人性化考虑我们还可以增加语音电路,实现自动语音播报重量。本设计一个能完成精确计量且LED数码显示的体重称,并且带有身高体重比例正常与否的语音提示。
关键词:STC89C51;体重称;LED数码管;语音播报
ABSTRACT
In this paper, a multifunctional weight weighing design is introduced. The design is based on a single chip microcomputer. The metal strain gauge is used to induce the weight of the human body. The analog output of the sensor is converted into a digital input microcontroller by AD converter.The propagation distance can be calculated from the propagation time of ultrasonic wave in air by using the principle of the constant velocity of ultrasonic wave in the medium, and the height measurement can be realized.The communication between MCU and host computer is realized by serial circuit.The design hardware circuit includes power supply circuit, MCU minimum system circuit, LCD screen circuit, serial communication circuit, independent keystroke circuit, buzzer circuit, ultrasonic module circuit and AD converter. Circuit and full bridge circuit.The software includes main program, system initialization program, AD converter communication program, key detection program, ultrasonic signal transmitting and receiving program, LCD screen driver program.
The whole design system is controlled by STC89C51 single-chip computer produced by Atmel Company, and the function of software realization is to start the detection, mainly to scan the LED digital tube one by one automatically after the boot, to prevent the damage of a section of digital tube from causing visual error.For the consideration of humanization, we can also increase the voice circuit and realize the weight of automatic voice broadcast.This design can achieve accurate measurement and LED digital display of electronic, and with a normal height and weight ratio of the voice hint.
Keywords: STC89C51; weight weighing LED digital tube; Voice broadcast
目 录
1绪论 1
1.1选题背景及意义 1
1.2研究现状 1
1.2.1 国内外体重称现状 1
1.2.2 体重称的发展趋势 2
1.3研究内容 3
2多功能体重称设计总体方案设计 4
2.1设计方案的选定 4
2.2多功能体重称设计的工作过程 5
3多功能体重称设计的硬件电路设计 6
3.1电源电路 6
3.2单片机最小系统电路 6
3.3串口通信电路 7
3.4超声波模块接口电路 8
3.5液晶屏电路 8
3.6语音播放模块 10
3.6.1 语音播放芯片ISD25120 10
3.6.2 ISD25120的直接寻址模式 10
3.6.3 ISD25120的直接寻址任意分段方式 10
3.6.4 ISD25120的硬件电路 10
3.7 HX711 AD转换器模块接口电路 11
3.8全桥电路 12
3.9总体硬件电路及其工作原理 13
4多功能体重称设计软件程序设计 15
4.1主函数的编写 15
4.2系统初始化函数的编写 17
4.3 HX711 AD转换器通信函数的编写 18
4.4超声波模块函数的编写 21
4.5液晶屏驱动函数的编写 22
4.6 ISD25120语音播报子程序 24
5开发平台及调试 25
5.1硬件的制作 26
5.2硬件的开发平台 26
5.3软件的调试 27
5.4软件的开发平台 28
5.5上位机软件 29
6总结 29
6.1特点 30
6.2不足与改进 30
参考文献 31
致 谢 32
附录:仿真电路图 33
附录:程序代码 34