【正文】
把設(shè)備放在車載網(wǎng)關(guān)的覆蓋范圍以內(nèi),打開設(shè)備電源,節(jié)點將自動加入網(wǎng)絡(luò)。這主要是因為,在傳輸過程中節(jié)點之間 存在一定的頻率干擾和其他干擾。根據(jù)設(shè)定的軟件參數(shù),如有數(shù)據(jù)包丟失則丟包數(shù)加 1。 總之,通過主機監(jiān)控軟件用戶可以直觀且多方面地對通用無線傳感器網(wǎng)絡(luò)系統(tǒng)進行了解和使用。 ② 拓撲顯示模塊。基于 μC / OSII 擴展的網(wǎng)關(guān)軟件平臺結(jié)構(gòu)如圖 5 所示。應(yīng)用配置模塊既會調(diào)用協(xié)議層提供的網(wǎng)絡(luò)服務(wù),也會直接對系統(tǒng)進行配置和查詢,這主要是通過 AT 指令來實現(xiàn)的,因此該模塊會調(diào)用應(yīng)用層接口和協(xié)議層接口提供的服務(wù)。 如圖 3 所示,本設(shè)計把軟件分為系統(tǒng)平臺層、協(xié)議層和應(yīng)用層 3 層。 MC908GB60 通過 引腳來控制 MC13192 進入不同的工作模式。 主控 MCU選用 Freescale公司 HCS08系列的低功耗、高性能微處理器 MC9S08GB60。系統(tǒng)通過這種休眠機制來減少系統(tǒng)的能量消耗,延長系統(tǒng)整體壽命。 如圖 1 所示,該車載系統(tǒng)分 3 個部分:車載監(jiān)控中心、車載網(wǎng)關(guān)和車載傳感器節(jié)點。借助通用無線傳感器網(wǎng)絡(luò),為車載系統(tǒng)擴展了監(jiān)控范圍和監(jiān)控功能,實現(xiàn)了車載設(shè)備狀態(tài)的數(shù)據(jù)采集和狀態(tài)監(jiān)視,以及必要的設(shè)備控制、拓撲控制、拓撲查詢等功能。 關(guān)鍵詞: 無線傳感器網(wǎng)絡(luò);監(jiān)測系統(tǒng); MC9S08GB60; MC13192 引言 為了滿足人們對車載安全性、操控性以及舒適性的要求,車載上集成了越來越多的電子系統(tǒng)。車載網(wǎng)關(guān)是整個車載系統(tǒng)的核心,可以和所有的車載傳感器節(jié)點通信。 本系統(tǒng)用 PC 機作為監(jiān)控中心, PC 機上的監(jiān)控軟件在 VB 環(huán)境下開發(fā),是一個基于對話框的應(yīng)用軟件。 該處理器具有 60 KB 的應(yīng)用可編程 Flash、 4 KB 的 RAM、 8 通道的 10 位 ADC、 2個異步串行通信接口 (SCI)、 1 個同步串行外部接口 (SPI)以及 I2C 總線模塊,完全能夠滿足車載網(wǎng)關(guān)和節(jié)點對處理器的要求。對傳感器的控制信號可以從 MC13192 的天線接收進來,通過 SPI 傳送到MCU 上,經(jīng)過 MCU 的判斷處理后通過 GPIO 口傳送到傳感器上,完成對傳感器的控制。同時,定義了 3 個 API 接口:系統(tǒng)層接口、協(xié)議層接口和應(yīng)用層接口。 圖 3 軟件總體結(jié)構(gòu) 3. 2 傳感器節(jié)點軟件設(shè)計 基于系統(tǒng)長期使用的功能需求,傳感器節(jié)點中軟件設(shè)計的關(guān)鍵是既能實現(xiàn)所需的功能,又能最大限度地減少傳感器節(jié)點的能耗?;?μC / OSII 操作系統(tǒng),分別構(gòu)建系統(tǒng)任務(wù) SYS_task()、 SMAC星型組網(wǎng)任務(wù) START_task()、網(wǎng)關(guān)和傳感器節(jié)點交互任務(wù) COMM_task()、 PC 臨控中心端口監(jiān)聽任務(wù) SER_task()等一系列應(yīng)用任務(wù),從而實現(xiàn)網(wǎng)關(guān)軟件的應(yīng)用功能。當用戶希望了解無線傳感器網(wǎng)絡(luò)的拓撲構(gòu)建情況時,可以查看拓撲信息欄,了解網(wǎng) 絡(luò)中節(jié)點的加入和丟失情況。 4 測試與驗證 4. 1 組網(wǎng)測試 測試設(shè)備: 4 個 MCl3192 ZigBee 芯片節(jié)點, 1 個作為網(wǎng)關(guān)節(jié)點,其余 3 個作為傳感器節(jié)點。若接收到數(shù)據(jù)包,則接收數(shù)據(jù)包數(shù)加 1,然后與發(fā)送數(shù)據(jù)進行比較,若數(shù)據(jù)正確則正確包數(shù)加 1,反之錯誤包數(shù)加 1。 4. 3 功耗測試 作狀態(tài)和休眠狀態(tài)下,分別使用萬用表測試網(wǎng)關(guān)節(jié)點和傳感器節(jié)點的功耗情況,測試結(jié)果如表 2 所列。 ③ 網(wǎng)絡(luò)自我修復(fù)能力。 ② 可擴展性。 實驗分析:在星形網(wǎng)絡(luò)中進行數(shù)據(jù)傳輸,測試結(jié)果明顯差于單點對單點傳輸方式。 測試方法:根據(jù) ZigBee 傳輸?shù)膸袷?,實際傳輸總字節(jié)數(shù)為 (n+6),即 (n+6)個字節(jié)為一個數(shù)據(jù)包。這些都可以通過控制模塊對系統(tǒng)進行相應(yīng)的設(shè)置,控制模塊還可以對系統(tǒng)中的某個不需要的節(jié)點進行刪除操作。該模塊的作用是將節(jié)點的數(shù)據(jù)以波形的形式實時地進行顯示,實現(xiàn)的方式是利用 MSChart 和 Timer 控件。根據(jù)網(wǎng)關(guān)的功能需 求,將 μC / OSII、 SMAC 協(xié)議有機的結(jié)合,構(gòu)成一個網(wǎng)絡(luò)化的操作環(huán)境,用戶可以方便地在其基礎(chǔ)上開發(fā)應(yīng)用程序。應(yīng)用層通 過應(yīng)用層接口來調(diào)用協(xié)議層提供的服務(wù),實現(xiàn)網(wǎng)絡(luò)的管理和數(shù)據(jù)傳輸?shù)热蝿?wù)。 SMAC 在不同硬件平臺的移植只需修改 PHY和 MAC 層,其上各層可以屏蔽硬 件差異直接運行。 MC13192 的中斷通過 IRQ 引腳和中斷寄存器來判斷中斷類型。它還具有一個優(yōu)化的數(shù)字核心,有助于降低 MCU 處理功率,縮短執(zhí)行周期。節(jié)點在活躍期完成數(shù)據(jù)采集,向網(wǎng)關(guān)發(fā)送數(shù)據(jù),接收并執(zhí)行網(wǎng)關(guān)命令;在休眠期關(guān)閉無線射頻模塊以節(jié)省能量,直到下一個活躍期來臨。這樣設(shè)計的目的是用一個監(jiān)控主機端來檢測多個待測目標環(huán)境,考慮到接入的數(shù)據(jù)吞吐量和軟件系統(tǒng)的復(fù)雜程度,采用時分復(fù)用的方式,逐個對網(wǎng)內(nèi)的終端采集點進行控制采集。 in the dormant period off the wireless RF module in order to save energy, until the next active period. System through this mechanism of dormancy to reduce energy consumption, extend the time span of the system as a whole. The system used PC as the control center, PC machine monitoring software in VB development environment, is a dialog based application software. In order to improve the munication module of the intelligent level, in the design, its function is not limited to the realtime data display, all of the data collection by the monitoring software by sending a request signal to the trigger. Considering the original data for subsequent processing and indepth analysis of the vehicle system, can accurately judge, software has also added data preservation of the document and data file display function. Generally speaking, the whole work are controlled by the host monitoring software, the working process of every node of the work is the need of human participation. 2 hardware system design chip introduction MC13192with standard, the operating frequency ~ GHz, data transmission rate of 250kbps, using 0QPSK debugging mode. This featurerich twoway transceiver with a data modem which can be in the ZigBee technology application. It also has an optimized digital core, helps to reduce the MCU processing power, shorten the cycle of execution. The main control MCU choose HCS08series of low power, high performance microprocessor MC9S08GB60. The processor has a 60Application of KB programmable Flash 、 4 KB RAM,10 ADC,8 channel2 asynchronous serial munication interface ( SCI ),1 synchronous serial interface ( SPI ) and I2C bus module, can fully meet the requirement of vehicle gateway and node processor requirements. MCl3192and MC9S08GB60hardware connection MC13192and MC9S08GB60 hardware connection diagram as shown in figure 2. The MC13192control and data transmission on 4 wire serial peripheral interface ( SPI ) is pleted, the4interface signals were MOSI, MISO, SPICLK. The main control MCU through the control signal ex