常 敏,崔永進,王昊遠
(上海理工大學 光電信息與計算機工程學院,上海 200093)
基于單片機的水位監(jiān)控系統(tǒng)仿真設計
常敏,崔永進,王昊遠
(上海理工大學 光電信息與計算機工程學院,上海200093)
摘要文中論述了以STC89C52單片機為核心的水位監(jiān)控系統(tǒng),水位信號由超聲波測距模塊DYP-ME007采集,通過單片機及LCD1602實時顯示水位。針對其特點設計電路接口,運用相關算法進行軟件編程,并在Proteus環(huán)境下進行實際仿真測試。仿真結果表明,該系統(tǒng)能實現(xiàn)對水位的實時顯示、處理和報警功能,且具有簡單可靠,抗干擾性及可移植性強等特點。
關鍵詞單片機;水位監(jiān)測控制;1602液晶顯示;Proteus仿真
Simulation Design of Water Level Monitoring System Based on MCU
CHANG Min,CUI Yongjin,WANG Haoyuan
(School of Optical-Electrical and Computer Engineering,University of Shanghai for
Science and Technology,Shanghai 200093,China)
AbstractThe water level monitoring system based on STC89C52 microcontroller is discussed in this paper.The water level signal is gathered by the ultrasonic ranging module DYP-ME007 and the level displayed continuously through the monolithic integrated circuit and LCD1602.The software programming of the interface circuit is performed using the related algorithm and simulated in Proteus.The result indicates that this system can realize real-time display,processing and alarm functions,and has the characteristics of simple structure,reliable operation,good anti-interference performance and portability.
KeywordsMCU;water level monitoring and control;LCD1602;Proteus simulation
水是生產(chǎn)、生活中必不可少的物質(zhì),而對水位的檢測與控制關系到生產(chǎn)、生活正常進行[1]。隨著新型電子技術和微型計算機的應用,單片機控制系統(tǒng)以其控制精度高、造價低等特點,被廣泛應用于水位系統(tǒng)控制中[2]。
1系統(tǒng)硬件設計
該系統(tǒng)由電源電路、超聲波測距模塊[3-4]、單片機系統(tǒng)、1602液晶顯示電路、光報警電路、繼電器控制水泵加水電路以及串口通訊電路等共同組成,實現(xiàn)對水位的實時顯示、處理和報警功能。系統(tǒng)結構如圖1所示。

圖1 水位監(jiān)控系統(tǒng)結構框圖
系統(tǒng)正常工作時,單片機STC89C52[5]編程產(chǎn)生10 μs以上的高電平信號,由P1.0端口[6]輸送給超聲波測距模塊的Trig端口,觸發(fā)超聲波測距模塊發(fā)射超聲波,當超聲波遇到被測水面時,會被反射回到超聲波測距模塊的接收探頭;超聲波測距模塊的Echo端口與單片機P3.2端口連接,利用單片機記錄超聲波發(fā)射的時間和接收到回波的時間,進而計算得到水位高度。……