1 / 15

感測網路實做

感測網路實做. Ethernet for MCU-KIT1 實驗 (UDP Client). KIT-1 UDP Ethernet 實驗. 實驗目標. 本 PPT 為此實習的 part-3 中的 Client 部分,旨在介紹 KIT-1 實驗版上的的網路編程方式 估計讓學生學習到以下概念 : 學習 / 使用 KIT-1 版上的 Ethernet 介面. KIT-1 UDP Ethernet 實驗. 實驗結果. 發送端一直發射 0~9 的數字 ( 次 /500ms) 接收端接收之後顯示. KIT-1 UDP Ethernet 實驗. 實驗板配置.

terena
Télécharger la présentation

感測網路實做

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 感測網路實做 Ethernet for MCU-KIT1實驗 (UDPClient)

  2. KIT-1 UDPEthernet 實驗 實驗目標 • 本PPT為此實習的part-3中的Client部分,旨在介紹KIT-1實驗版上的的網路編程方式 • 估計讓學生學習到以下概念: • 學習/使用KIT-1版上的Ethernet介面

  3. KIT-1 UDPEthernet 實驗 實驗結果 • 發送端一直發射0~9的數字(次/500ms) • 接收端接收之後顯示

  4. KIT-1 UDPEthernet 實驗 實驗板配置 將網路線接在RJ45上,另一端連接switch,或者是用cross over線對接電腦

  5. Ethernet 介面架構 • MIT-KIT-1版上的Ethernet介面採用晶片CP2201來實做,然後將從CP2201的資料,透過UART的方式,轉發到CC2530之中 • 因為MCU透過UART的方式,來抓取Ethernet的資料,這也是為什麼在稍後寫程式的時候,function的名字都是halUart開頭,而不是較符合網路原意的halEthernet開頭,ex:抓資料的halUartRead()function • 簡略電路架構如下 Uart Ethernet 高速USB微控器 將資料轉用UART的方式傳過去 待查 應該是耦合電路 Ethernet 控制器

  6. Ethernet 介面 詳細電路圖 2.TM165S-B 1.RJ-45 3.CP2201

  7. Ethernet 介面 詳細電路圖 4.MG84FL54BD 5.MCU座

  8. KIT-1 UDPEthernet 實驗 專案配置 Workspace內的target,使用mcu-kit1內的library • components\targets\mcu-kit1

  9. KIT-1 UDPEthernet 編程介紹

  10. KIT-1 UDPEthernet 實驗 發送資料function • halUartWrite(uint8 * buffer , uint16 buffer_size ) • buffer: 要傳送進去的buffer,結構是uint8,即1位元組,可用char替代 • buffer_size: 傳送的buffer大小,單位是byte。 範例: char buffer[]="1234"; halUartWrite(buffer,5);

  11. KIT-1 UDPEthernet 實驗 查接收資料長度function • uint16 halUartRxLen() • 回傳此次接收資料的長度(單位byte),如果沒有接收到資料,則回傳0,最好跟halUartRead搭配使用,避免讀取的資料超過儲存的長度,發生未知錯誤。 範例: 假設傳一個16byte的資料過來 uint16 buffer_size= halUartRxLen(); 則buffer_size為16

  12. KIT-1 UDPEthernet 實驗 接收資料function • halUartRead(uint8 * buffer , uint16 buffer_size ) • buffer: 將讀取盜的數值存起來的buffer,結構是uint8,即1位元組,可用char替代 • buffer_size: 要接收的大小,單位是byte。 • 最好跟halUartRxLen搭配使用,避免要讀的長度超過buffer目前儲存的長度,發生未知的錯誤。 範例: char buffer[] ; halUartRead(buffer,5);

  13. KIT-1 UDPEthernet 實驗 IP設定方法 • 先把電源線接到KIT-1版上的電源孔 • 等待驅動程式安裝(Win7會有問題,請用虛擬機安裝XP來用) • 啟動MCU_KIT_NET_Tools_0150.exe設定IP

  14. KIT-1 UDPEthernet 實驗 IP設定方法 • 選擇相對應的COM之後,選連線,成功會變黃,失敗為紅 成功 失敗 • 接著在設定IP,之後選Set即可

  15. KIT-1 UDPEthernet 實驗 應用 • 收集各類感測的資料,回傳電腦分析 • 接收電腦資料,更改遠端感測器的設定 • 當作資料蒐集中繼站,處理資料後回傳電腦分析 • 當作資料蒐集中繼站,處理資料後發送給其他中繼站處理

More Related