隨著數據通信技術的發展,采用PC 與多臺單片機構成的分布式系統、工業控制系統、數據傳輸系統等越來越受到廣泛應用。本課題在國內外已受到非常多的關注與研究,并且不斷的得到改進,在實際應用中也取到了較好的效果,具有非常好的應用推廣價值。
本課題的主要研究工作是在PC機與單片機的數據通信中采用RS485 總線組建的遠程雙向數據通信系統的系統結構、硬件設計。因此本文主要介紹了基于RS485總線的遠程雙向數據通信系統平臺構成,描述了上位PC機負責通信(包括與單片機之間的串行通信和數據的遠程通信)、數據處理以及用VB6.0建立在Window2000/ XP 環境下的計算機端通信軟件和用單片機KeilC51 編寫的下位機通信軟件等工作。另外,也對本系統所采用的可靠性、抗干擾措施和容錯設計作了一些介紹.在本系統中,上位機以PC和Windows操作系統為軟、硬件資源;下位機采用ATMEL公司89S52,總線標準采用的是測控系統常用的RS-485。
將該系統運用到賓館客房環境監測系統中,下位機的溫濕度傳感器SHT11和煙霧傳感器MQ-N5采集數據到數據后,通過此485總線系統能將測量數據(溫濕度)傳送到PC機上顯示,對檢測到煙霧起報警作用。試驗結果最終表明,該系統整體實現了實時性較好,運行穩定可靠。
關鍵詞:串行通信;RS-485總線;VB6.0; 89S52;遠程雙向數據通信;
Abstract
With the development of digital communication technology,the distribute-type systems, industrial control systems, data transmission systems,.etc, which adopts PC to constitute with many microcontrollers to be subjected to more and more extensively applied. This topic is continuously having already been subjected to quite a few concern and research at home and abroad, and getting a continuous improvement, also taking better result in physical application, having very nice expansion value.
The main research work of this topic is the system structure, hardware design in the PC and SCM data communications,which is using Long-range two-way data communication system established by RS-485 . So this text mainly introduced the terrace according to the constitute of the Long-range two-way data communication system established by RS-485 ,describing the place of honor PC machine to be responsible for correspondence (including with the line correspondence to scm and data in the long-disdance correspondence), data processing , using VB6.0 builds the computer software and communications - SCM software prepared with KeilC51 in Window2000 / XP environment and so on. Moreover, also making some introduction to the credibility, anti- interference measure and the system-permitted- wrong design .In this system ,the honor PC machine uses PC and Windows operating system for software and hardware resources ; the lower computer adopts 89S51 which is produced by ATMEL Corporation, Bus standard adopts the monitoring system that is commonly used RS-485 .
Make use of that system to the environment monitor of the hotel room in the system, , after the temperature and humidity sensor SHT11 and smoke senstor MQ-N5 of the lower PC collecting the data to the data,can send measurement data(temperature and humidity) to the PC by 485 bus system , it rightly plays an alarm starting role to the process that detects smoke . Final test results show that the system achieved a better real-time, stable and reliable operation as a whole.
Keyword: Serial Communication ; RS-485 bus ;VB6.0; 89S52; Long-range two-way data communication ;