freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

基于c的rs232通信協(xié)議模擬終端所有專業(yè)(存儲(chǔ)版)

2025-07-09 15:28上一頁面

下一頁面
  

【正文】 軟件的實(shí)現(xiàn)及其測(cè)試 ................................................................................................ 14 開發(fā)工具概述 ........................................................................................................... 14 Windows 編程與 MFC ................................................................................... 14 串行通信控件 MSComm .............................................................................. 14 程序的主要功能 ....................................................................................................... 15 程序運(yùn)行平臺(tái) ........................................................................................................... 17 II 詳細(xì)設(shè)計(jì) .................................................................................................................... 17 建立工程 ........................................................................................................ 17 界面功能實(shí)現(xiàn) ................................................................................................ 18 模塊分析 ........................................................................................................ 21 程序測(cè)試 ........................................................................................................ 34 本章小結(jié) ................................................................................................................... 39 第 5 章 結(jié)論 ............................................................................................................................ 40 參 考 文 獻(xiàn) ............................................................................................................................ 41 致 謝 .................................................................................................... 錯(cuò)誤 !未定義書簽。利用 MSComm ActiveX 串行通信控件來實(shí)現(xiàn)串行通信。通信的方式多種多樣,以何種方式實(shí)現(xiàn)通信主要取決于通信 設(shè)備。 詳細(xì)的分析了幾種主要的通信參數(shù)。 關(guān)鍵詞: RS232 標(biāo)準(zhǔn) ;串行通信; C++; CRC 校驗(yàn) II Abstract With the rapid development of science and technology, munication technology has bee an indispensable part of social economy, environment, living and learning. There are many kinds of munication modes. The selection of munication mode mainly depends on the munication equipment. In industrial control systems and laboratory, serial munication is widely used in puter and external equipment due to the simple and flexible advantage. Around serial munication technology, this paper mainly introduces the serial munication interface RS232 serial port, and expounds the basic principle of RS232 serial munication and CRC check .It is pleted to realize serial munication by VC programming. It can check the data during the process of transmission through the CRC. In the study of RS232 serial munication principle, this design mainly introduces the principle of serial munication, serial port and RS232 protocol, and analyzes munication parameters in detail. Considering RS232 serial port and working principle, this design adopts serial fullduplex mode to realize munication. In the article, the interface is the USB port on the PC. In the aspect of software realization, after several methods are pared,this design selects the MFC application program which is based on C++ .The design realize the serial munication by using MSComm ActiveX serial munication control. This article introduces the ActiveX control technologyMSComm control. Finally, the design realizes serial munication between two puters. Because of the advantages of low cost and simple structure, serial munication is widely used by people. Realization of serial munication between two PC machines is the foundation of realizing more plex munication. Keywords:RS232 protocol。 Windows 圖形界面 編程下的 MFC,全稱是 Microsoft Foundation Classes,它是 Win32 中的應(yīng)用程序, 目前 Win32 中基于 VC++ 的串口通信程序一般可以用兩種方法實(shí)現(xiàn):一是利用 MSComm ActiveX 串行通信控件;二是使用Windows API 通信函數(shù)。 研究現(xiàn)狀及發(fā)展趨勢(shì) RS232串行通信的研究現(xiàn)狀 目前,串行通信在各類領(lǐng)域中都得到了廣泛的應(yīng)用,同時(shí)它還具有較高的性價(jià)比和傳輸 可靠性等優(yōu)點(diǎn)。我們堅(jiān)信 RS232 一定會(huì)繼續(xù)隨著各種外圍設(shè)備的不斷發(fā)展而提高,同時(shí)也將繼續(xù)保持通信領(lǐng)域中 應(yīng)用最為廣泛這一地位的 。 RS232C 標(biāo)準(zhǔn)是美國(guó) EIA(電子工業(yè)聯(lián)合會(huì))與 BELL 等公司一起開發(fā)的 1969 年公布的通信協(xié)議。 RS232 接口是標(biāo)準(zhǔn)串行接口,其通訊距離小于 15 m, 它的傳輸速率小于 20 kb/ s。從同時(shí)傳輸?shù)臄?shù)據(jù)位數(shù)來分通信方式可以分為串行通信( Serial)和并行通信( Parrel)。在接收數(shù)據(jù)時(shí),數(shù)據(jù)格式由串行的位( bit)被轉(zhuǎn)換為字節(jié)數(shù)據(jù)。 (2)數(shù)據(jù)位 數(shù)據(jù)位 是衡量通信中實(shí)際數(shù)據(jù)位的參數(shù)。停止位的位數(shù)的設(shè)置可以由設(shè)備的軟件設(shè)置,停止位的位數(shù)越多,不同時(shí)鐘同步的容忍程度越大,但是數(shù)據(jù)傳輸率相應(yīng)地也會(huì)越慢。它是一種連續(xù)串行傳送數(shù)據(jù)的通信方式,一次通信只傳送一幀信息。 當(dāng)然它也具有自己獨(dú)特的優(yōu)點(diǎn), 其優(yōu) 點(diǎn)就是它的通信設(shè)備簡(jiǎn)單、便宜。 由表 21 可知要想實(shí)現(xiàn)兩臺(tái)個(gè)人計(jì)算機(jī)間的數(shù)據(jù)交換,可以將兩個(gè) USB 轉(zhuǎn)RS232 線的接口頭的 3 引腳交叉對(duì)接,兩個(gè) 5 腳相接 即可,具體接法如 圖24 所示,然后再講兩個(gè) USB 接頭與兩臺(tái)電腦相連。 為下文編寫 Windows 應(yīng)用程序?qū)崿F(xiàn)兩臺(tái) PC 機(jī)進(jìn)行數(shù)據(jù)交換提供了基礎(chǔ)。 CRC( Cyclic Redundancy Check)循環(huán)冗余校驗(yàn)碼是數(shù)據(jù)通信領(lǐng)域中最常用的一種差錯(cuò)校驗(yàn)碼,其特征是信息字段和校驗(yàn)字段的長(zhǎng)度可以任意選定, CRC循環(huán)冗余校驗(yàn)碼的基本原理是任意一個(gè)由二進(jìn)制位串組成的代碼都可以和一個(gè)系數(shù)僅為 ?0?和 ?1?取 值的多項(xiàng)式一一對(duì)應(yīng) [9]。從把數(shù)據(jù)移位開始計(jì)算,將數(shù)據(jù)位(從最低的數(shù)據(jù)位開始)逐位移入反向耦合移位寄存器。 本章介紹了通信中最常使用的校驗(yàn)方法,即 CRC 校驗(yàn)。 Windows應(yīng)用 程序的框架主要有兩種類型,一種是基于對(duì)話框的應(yīng)用程序框架,另外一種是基于文檔、視圖結(jié)構(gòu)的應(yīng)用程序框架。 其余一種是利用 MSComm ActiveX 串行通信控件 。在發(fā)送接收數(shù)據(jù)過程中需要打開串口。并將這個(gè)應(yīng)用程序命名為通信 [17,18]。 19 首先,啟動(dòng) Microsoft Office Access,建立 Access 數(shù)據(jù)庫,命名為 demo01,然后在數(shù)據(jù)庫中創(chuàng)建一個(gè)表,命名為 puser,在表 puser 中輸入序號(hào)( userid)、用戶名( username)和密碼( userpwd),將這個(gè)數(shù)據(jù)庫保存。接收區(qū)由靜態(tài)文本框和編輯框組成;發(fā)送區(qū)同樣也是由靜態(tài)文本框和邊界框組成;設(shè)置區(qū)由組合框、 復(fù)選框、 按鈕和靜態(tài)文本框組成。 } void CMylogin::OnOK() { TODO: Add extra validation here UpdateData(TRUE)。//用來作為檢索條件,字符串格式化輸出 (CRecordset::snapshot,NULL,CRecordset::none)。 return。 //選擇 COM4端口 (1)。 UpdateData(true)。 if(!()) { (TRUE)。加入 MSComm 通信控件, 實(shí)現(xiàn)從緩沖區(qū)中讀取數(shù)據(jù),同時(shí)將數(shù)據(jù)給接收變量,更新接收區(qū)編輯框的內(nèi)容 。 ///變量轉(zhuǎn)換 len=()。 //字符型 if(()) (%02X ,bt)。 //加入接收編輯框?qū)?yīng)字符串 } } CString temp=(\r\n)。 = m_stopbit。break。 default:conf = conf+n,。 case 3:conf = conf + 8,。 case 2:conf = conf + 2。 //讀取編輯框內(nèi)容 if(()) { CByteArray hexdata。 UpdateData(false)。 int len=()。 continue。 i++。amp。(ch=39。amp。 圖 416 用戶名密碼不一致 輸入正確用戶名和密碼,程序提示 “登錄成功!歡迎使用! ”如圖 417 所示。 38 圖 420 十六進(jìn)制顯示和計(jì)
點(diǎn)擊復(fù)制文檔內(nèi)容
畢業(yè)設(shè)計(jì)相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1