I基于单片机的酒精浓度测试系统设计摘要因酒精引起的安全问题逐年增加,酒精浓度测试系统也成为当今安全领域的研究热点。本次设计是对酒精浓度测试系统进行研究,借助编程来实现酒精浓度测试。酒精浓度测试系统的设计包含传感器、单片机、编程等多方面知识。本次设计一共分为硬件和软件系统,其中控制芯片选用STC89C52RC单片机;选用MQ-3酒精浓度传感器作为系统的信号收集模块,利用传感器采集信号,经过模数转换将信号转换为能被单片机识别的数字信号;采用LCD液晶显示器进行最终的显示。软件系统采用C语言编程,对系统各个模块分开编写控制。本次设计的系统硬件和软件都采用模块化结构,通过对酒精浓度测试系统硬件的选择和程序的编写,最终完成了基于单片机的酒精浓度测试系统设计。关键词:STC89C52RCRC单片机;C语言;MQ-3酒精传感器IIDesignofalcoholconcentrationtestsystembasedonMCUAbstractWiththeincreasingsafetyproblemscausedbyalcohol,alcoholconcentrationtestsystemhasbecomeahotresearchfieldintoday'ssecurityfield.Thisdesignisthealcoholconcentrationtestsystemtostudy,withprogrammingtoachievethefinalalcoholconcentrationtest.Alcoholconcentrationtestsystemdesignincludessensors,microcontrollers,programmingandotheraspectsofknowledge.Thedesignofatotalofhardwareandsoftwareisdividedintotwomajorsystems,includingthecentralcontrolofthehardwaresystemcoreselectionSTC89C52RCmicrocontroller;useMQ-3alcoholconcentrationsensorasasystemofsignalcollectionmodule,andtheuseofsensorstocollectsignalsandsignalscanbeconvertedintoSingle-chipidentificationofdigitalsignals;usingLCDliquidcrystaldisplayforthefinaltestresultsshow.SoftwaresystemusingClanguageprogramming,thesystemseparatelypreparedtocontrolthevariousmodules.Thedesignofthesystemhardwareandsoftwarearemodularstructure,throughthealcoholconcentrationtestsystemhardwareselectionandproceduresforthepreparation,andultimatelycompletedthesingle-chipbasedonthealcoholconcentrationtestsystemdesign.KeyWords:STC89C52RCRCmicrocontroller;Clanguage;MQ-3alcoholsensorIII目录1绪论.......................................................................................................................11.1课题背景.............................................................................................................11.2现状及发展趋势.................................................................................................11.3研究意义.............................................................................................................21.4研究内容.............................................................................................................21.5系统总体思路.....................................................................................................22系统总体方案设计...........................................................................................32.1总体设计.............................................................................................................32.2处理器优势论证.................................................................................................32.3显示部分论证.....................................................................................................43硬件电路设计....................................................................................................53.1单片机的选择.....................................................................................................53.1.1单片机介绍..................................................................................................53.1.2STC89C52RC单片机主要性能参数..........................................................63.2传感器.................................................................................................................73.2.1MQ-3酒精传感器介绍................................................................................73.2.2MQ-3酒精传感器关键部件材料................................................................73.2.3MQ-3酒精传感器各项技术指标................................................................73.2.4MQ-3酒精传感器结构................................................................................93.2.5MQ-3酒精传感器系统电路........................................................................93.3模数转换器.......................................................................................................103.4电源电路...........................................................................................................113.5LCD显示...........................................................................................................113.5.1LCD1602液晶显示器主要参数................................................................113.5.2LCD1602液晶显示器引脚及其功能........................................................113.6报警设计...........................................................................................................133.7按键电路设计...................................................................................................143.8存储电路...........................................................................................................153.9系统硬件设计原理图分析...............................................................................154系统软件的设计..............................................................................................17IV4.1主程序设计.......................................................................................................174.2A/D转换器程序流程图....................................................................................185程序调试与实验结果........................................................................