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

正文內(nèi)容

單片機課程設(shè)計論文-基于c++builder的pc機與單片機之間的串口通信-全文預(yù)覽

2024-12-15 22:14 上一頁面

下一頁面
  

【正文】 9)。 load_109(amp。buf_109[7]==39。 }//查詢量程上限 else if(buf_109[6]==39。 load_109(0104)。) { count_109=0。amp。(buf_109[9]==39。(buf_109[8]==39。(buf_109[4]==slave_addr_109[2])amp。 } }//查詢地址 else if((buf_109[2]==slave_addr_109[0])amp。 load_109(0004)。) { count_109=0。amp。(buf_109[9]==39。(buf_109[8]==39。(buf_109[5]==39。(buf_109[4]==39。(buf_109[3]==39。 } } void send_109() { if(count_109==13) { 17 if((buf_109[3]==39。 } } void load_109(uchar *msg_109) { while(*msg_109!=0) { SBUF=*msg_109。j_109++)。//標(biāo)志點亮 P1口連接的LED(已接高) uint j_109。 char slave_bj_109h_109[]=9000。//蜂鳴器 char buf_109[30]。當(dāng)輸出 1 時,相應(yīng)的 LED 熄滅,當(dāng)輸出 0 時,相應(yīng)的 LED 點亮。否則,對應(yīng) P1口線上輸入 1,同時相應(yīng)的 LED 熄滅。 當(dāng)選擇 USB 轉(zhuǎn) URAT 電路時, PC 機的 USB 口同時承擔(dān)給實驗板供電的任務(wù)。 由于單片機只有一個串口,所以以上兩部分通過雙刀雙擲開關(guān)切換使用,當(dāng)實驗板上 S- COM 開關(guān)按下時選擇 USB 轉(zhuǎn) URAT 電路。最后,對 Keil、燒寫軟件、串口調(diào)試助手以及試驗箱的熟練使用也是這次課設(shè)成功的重要因素 。幸運的是,在同學(xué)的幫助下順利地解決了這個問題。鑒于已經(jīng)系統(tǒng)地學(xué)過 C 語言以及單片機中常用 C 的編寫,程序的整體架構(gòu)不存在多大問題。 遵循著“中斷中程序盡可能少些,一般放在主程序部分實現(xiàn)”的原則,對于我這次拓展的一點點功能( LED 燈顯示、報警蜂鳴器響,程序見 ),我把標(biāo)志位 flag 的設(shè)置放在了解析函數(shù) void send()部分,將 LED 顯示放在了主函數(shù)中。 load_109(X)。slave_addr_109)。039。039。amp。amp。amp。amp。amp。 break。 TI=0。 TI=0。 TI=0。 while(!TI)。 SBUF=slave_addr[1]。 TI=0。 TI=0。 TI=0。 TI=0。 TI=0。 while(!TI)。 SBUF=slave_addr[1]。 TI=0。 TI=0。://查詢地址 TI=0。 9 對此,我前后采用了兩種方法進(jìn)行調(diào)試運行(以下程序僅為“查詢功能” 模塊的代碼 ) 方案一: void send() { if(host[6]==39。 ( 2)如何判斷從機已經(jīng)接收到完整的數(shù)據(jù)幀即結(jié)束接收。 ( 3)有時發(fā)送數(shù)據(jù)后接收窗口無顯示,經(jīng)過復(fù)位后,問題得以解決。 6 圖 5 串口初始化 從機(單片機)接收主機( PC 機)發(fā)送來的數(shù)據(jù)幀 7 從機發(fā)送數(shù)據(jù)幀給主機 ( 1) 解析從機 發(fā)送的 數(shù)據(jù)幀(程序見附錄 3 的 void send()部分) ( 2) 從機發(fā)送 數(shù)據(jù)幀 拓展部分 利用 P1 口連接的 8 個 LED 燈來顯 示 C++Builder 的十三個功能(見附錄 1)。 圖 4 如圖 4, PC 機作為主機, 80C51 單片機作為從機(波特率為 9600b/s)。 1 6S B U FT 1 溢 出 率 5 由于基于 C++Builder 的通信協(xié)議 如圖 3 所示,因此在程序編寫時,需要在設(shè)置一個緩沖區(qū)來暫時存儲單片機接收的來自 PC 機的一串字符串。當(dāng) RI=0,且 SM2=0(或接收到的停止位為 1)時,將接收到的 9 位數(shù)據(jù)的前 8 位數(shù)據(jù)裝入接收 SBUF,第 9 位(停止位)進(jìn)入 RB8,并置 RI=1,向 CPU 請求中斷。 TXD 為數(shù)據(jù)發(fā)送引腳, RXD 為數(shù)據(jù)接收引腳,傳送一幀數(shù)據(jù)的格式 如圖 2 所示。 接下來將會描述本次課設(shè) PC 機與單片機間的串行通信原理、相關(guān)軟硬件設(shè)計及流程圖。單片機常被用作工業(yè)自動化系統(tǒng)中的前端處理器(也稱下位機)。 通過串口,我們的個人電腦和單片機系統(tǒng)進(jìn)行通信。因此為了能夠?qū)⒄n堂上學(xué)到的理論知識與實際應(yīng)用結(jié)合起來,而且能夠?qū)﹄娮与娐?、?子元器件、 印制電路板等方面的知識進(jìn)一步加深認(rèn)識,此次課設(shè) 主題為單片機串口通信的應(yīng)用之一。 關(guān)鍵字:單片機、 PC 機、串口通信、 C++ Builder Abstract SCM is a technical, applied a strong discipline, if not in practice, work hard skills training, theoretical study of the classroom alone, theory and practice is bound to appear out of line, the gap between learning and application of situation. Therefore, in order to be able to classroom and practical application of theoretical knowledge bined, but also on the electronic circuits, electronic ponents, printed circuit boards and other knowledge to further deepen understanding of the theme of the course based Application Serial Communication one. Through the serial port, our personal puter and microcontroller systems to municate. PC as the host puter, the downbit machine microcontroller system to send data frames after receiving the SCM system, sends back the requested data munication protocol frame. Can make C + + Builder application language interface or serial debugging assistant string input box numbers and characters to achieve the PC, and 80C51 series microcontroller serial munication. Keywords: microcontroller, PC, serial munication, C + + Builder 3 目 錄 摘 要 .......................................................................................................................... 2 一、 需求分析 ........................................................................................................... 4 二、 系統(tǒng)設(shè)計及詳細(xì)設(shè)計 .............................................................................. 4 1. 串行通信原理 .............................................................................................. 4 2. 硬件設(shè)計 ........................................................
點擊復(fù)制文檔內(nèi)容
高考資料相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1