【正文】
陜西科技大學(xué)畢業(yè)論文(設(shè)計(jì)說明書) I 溫濕度測量系統(tǒng)設(shè)計(jì)(上位機(jī)軟件設(shè)計(jì)) 摘 要 本課題實(shí)現(xiàn)方法是 上位機(jī) 通過 RS_485總線及規(guī)定的通信協(xié)議 發(fā)出的命令 發(fā)送 給下位機(jī),下位機(jī)再根據(jù)此命令解釋成相應(yīng)時序信號直接控制 傳感器 。下位機(jī)不時讀取設(shè)備狀態(tài)數(shù)據(jù) ,轉(zhuǎn)換成數(shù)字信號反饋給上位機(jī) 。 上位機(jī)對接收到的數(shù)據(jù)經(jīng)過處理,在上位機(jī)上顯示和存儲與數(shù)據(jù)庫中等。同時上位機(jī)對用戶進(jìn)行管理,方便用戶對采集到的數(shù)據(jù)進(jìn)行查看及對歷史數(shù)據(jù)的查詢等。 介紹了溫濕度測量系統(tǒng)上位機(jī)的軟 件構(gòu)成。用 Visual C++作為開發(fā)平臺,采用 MFC類庫,利用 基 于對話框的模板 , Microsoft Access 作為后臺開發(fā)數(shù)據(jù)庫 ,并利用MSComm 控件完成串口通信 設(shè)計(jì)了一個 實(shí)時監(jiān)測上位機(jī)軟件系統(tǒng)。 本文從上位機(jī)軟件出發(fā),利用面向?qū)ο蟆?shù)據(jù)庫、串口通信 等技術(shù) 完成 系統(tǒng) 信息和 數(shù)據(jù)存儲、數(shù)據(jù)和曲線實(shí)時顯示、 歷時查詢、等功能,實(shí)現(xiàn)了上位機(jī)系統(tǒng)的 監(jiān)測任務(wù)。給出了軟件的總體設(shè)計(jì)方案和各功能模塊的設(shè)計(jì) , 說明 了該軟件的主要功能 ,并給出了系統(tǒng)的運(yùn)行界面和應(yīng)用模式。 關(guān)鍵詞 : 溫濕度,數(shù)據(jù)采集, 串口通信, MFC,上位機(jī) , MSComm 溫濕度測量系統(tǒng)設(shè)計(jì)(上位機(jī)軟件設(shè)計(jì)) II Temperature and humidity measurement system design ( PC software design) ABSTRACT Approach is PC through RS_485 bus and provisions of the munication protocol under orders to send out a machine, lower level puter according to this mand to explain again into corresponding timing signal directly control sensor. From lower level puter equipment state data, converted into digital signal feedback to the PC. PC docking receive data processed, in upper machine display and storage and database medium. Meanwhile PC user management, the convenient user for the collected data in view of historical data and the query etc. Introduced the temperature and humidity measurement system of software constitutes upper machine. Use Visual C + + as a development platform, using MFC libraries, using dialogbased templates, Microsoft Access as a background, and by using the development of database MSComm control design for a plete serial munication realtime monitoring PC software system. This paper, starting from the PC software by using objectoriented, database, serial munication technology plete system information and data storage, data and curve realtime display, lasted inquiry, and other functions, realized the PC system monitoring task. Given the general design of the software solutions and the function module design, shows the software39。s main function is presented, and the operation of the system interface and application mode. KEY WORDS: Temperature and humidity, Serial munication, Data acquisition, MFC, PC, MSComm 陜西科技大學(xué)畢業(yè)論文(設(shè)計(jì)說明書) III 目 錄 摘 要 .................................................................... I ABSTRACT ................................................................ II 1 緒論 .................................................................... 1 課題意義及目的 ................................................... 1 課題主要研究的內(nèi)容 ............................................... 1 2 面向過程與面向?qū)ο? ..................................................... 2 面向過程與面向?qū)ο蠹夹g(shù) ........................................... 2 面向?qū)ο蟮某绦蛟O(shè)計(jì) ............................................... 4 本章小結(jié) .......................................................... 5 3 系統(tǒng)相關(guān)技術(shù)介紹 ........................................................ 6 Visual C++開發(fā)平臺 ............................................... 6 Windows 編程模型 ............................................ 6 VC++應(yīng)用程序創(chuàng)建過程 ....................................... 7 VC++集成開發(fā)環(huán)境介紹 ....................................... 8 數(shù)據(jù)庫技術(shù) ........................................................ 9 VC++ 開發(fā)數(shù)據(jù)庫技術(shù)的特點(diǎn) ................................ 9 SQL 語言概述 ............................................... 10 ADO 數(shù)據(jù)庫訪問技術(shù) ......................................... 12 單片機(jī)與 PC 串口通信技術(shù) ......................................... 17 數(shù)據(jù)通信的概念 ............................................ 17 串行通信的通信方式 ........................................ 18 串行通信的過程及通信協(xié)議 .................................. 19 實(shí)時數(shù)據(jù)顯示技術(shù) ................................................ 20 VC++串口通信技術(shù) ................................................ 20 事件驅(qū)動方式 .............................................. 21 查詢方式 .................................................. 21 MSComm 控件串口編程基本流程 ..................................... 23 在當(dāng)前 Project 中插入 MSComm 控件 ........................... 24 初始化并打開串口 .......................................... 24 捕捉串口事項(xiàng) .............................................. 25 串口讀寫 .................................................. 25 關(guān)閉串口 .................................................. 26 溫濕度測量系統(tǒng)設(shè)計(jì)(上位機(jī)軟件設(shè)計(jì)) IV 本章小結(jié) ......................................................... 26 4 系統(tǒng)總體設(shè)計(jì) ........................................................... 27 系統(tǒng)功能描 述 ..................................................... 27 系統(tǒng)總體設(shè)計(jì) ..................................................... 27 系統(tǒng)的通信協(xié)議 ................................................... 28 模塊接口協(xié)議格式 ........................................... 28 上位機(jī)命令幀數(shù)據(jù)格式 ....................................... 29 下位機(jī)上傳數(shù)據(jù)幀格式 ....................................... 29 本章小結(jié) ..................................................... 30 5 上位機(jī)軟件設(shè)計(jì)與各模塊的實(shí)現(xiàn) ........................................... 31 系統(tǒng)功能模塊劃分 ................................................ 31 用戶登錄的設(shè)計(jì) ............................................ 31 系統(tǒng)軟件程序設(shè)計(jì) ........................................... 34 相關(guān)數(shù)據(jù)庫的設(shè)計(jì) ................................................ 39 數(shù)據(jù)庫配置 ................................................ 39 使用 訪問數(shù)據(jù)庫 .................................... 39 VC++到數(shù)據(jù)庫的連接 ........................................ 40 數(shù)據(jù)庫中表的設(shè)計(jì) ................................................ 43 本章小結(jié) ........................................................ 43 6 結(jié)束語 ................................................................ 44 致 謝 ................................................................... 45 參 考 文 獻(xiàn) ............................................................. 46 陜西科技大學(xué)畢業(yè)論文(設(shè)計(jì)說明書) 1 1 緒論 課題意義及目的 在工農(nóng)業(yè)生產(chǎn)、日常生活以及科學(xué)研究等諸多領(lǐng)域中,溫度和濕度是兩個很普遍而又非常重要的參數(shù)。因此,在這些領(lǐng)域中,對于這兩個參數(shù)的測量與控制就顯得尤為重要,特別是在紡織工業(yè)、冶金、化工、食品、溫室種植,汽車制造以及氣象預(yù)報和