摘 要
本文介绍了一个基于单片机的称重系统设计,本设计以单片机为平台,利用金属应变片来感应人体的重量,传感器输出模拟量经 AD转换器转换成数字量传入单片机。利用超声波在介质中传播速度固定的原理可由超声波在空气中的传播时间算出传播距离,实现身高的测量。通过串口电路实现了单片机与上位机的通信。本设计硬件电路包括电源电路、单片机最小系统电路、液晶屏电路、串口通信电路、独立按键电路、蜂鸣器电路、超声波模块电路、AD转换器电路和全桥电路。软件部分包括主程序、系统初始化程序、AD转换器通信程序、按键检测程序、超声波信号发射及接收程序、液晶屏驱动程序。
整个设计系统由Atmel公司生产STC89C51单片机进行控制;软件实现功能开机检测,主要是开机后自动逐个扫描LED数码管,以防止某段数码管损坏造成视觉误差;出于人性化考虑我们还可以增加语音电路,实现自动语音播报重量。本设计一个能完成精确计量且LED数码显示的电子称,并且带有身高体重比例正常与否的语音提示。
关键词:STC89C51;称重仪;LED数码管;语音播报
ABSTRACT
This paper introduces the design of a weighing system based on a single chip microcomputer. The design is based on a single chip microcomputer and uses metal strain gauges to induce the weight of the human body. The analog output of the sensor is converted into digital input into a single chip microcomputer by AD converter. The propagation distance can be calculated from the propagation time of ultrasonic wave in the air by using the principle of the constant propagation speed of ultrasonic wave in the medium. The hardware circuit of this design includes power supply circuit, MCU minimum system circuit, LCD screen circuit, serial communication circuit, independent keystroke circuit, etc. Buzzer circuit D 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. Due to the consideration of humanization, we can also increase the speech circuit and realize the weight of the automatic voice broadcast. This design can accomplish the accurate measurement and the LED digital display, and has the voice prompt with the normal ratio of height and weight.
Keywords: STC89C51; weighing instrument; LED digital tube; voice broadcast
目 录