物聯(lián)網(wǎng)傳感器原理與應(yīng)用課程試驗指導(dǎo)書——實訓(xùn)_第1頁
物聯(lián)網(wǎng)傳感器原理與應(yīng)用課程試驗指導(dǎo)書——實訓(xùn)_第2頁
物聯(lián)網(wǎng)傳感器原理與應(yīng)用課程試驗指導(dǎo)書——實訓(xùn)_第3頁
物聯(lián)網(wǎng)傳感器原理與應(yīng)用課程試驗指導(dǎo)書——實訓(xùn)_第4頁
物聯(lián)網(wǎng)傳感器原理與應(yīng)用課程試驗指導(dǎo)書——實訓(xùn)_第5頁
已閱讀5頁,還剩4頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、實訓(xùn)二壓力傳感器實驗1 .實驗環(huán)境?硬件:ZIGBEE(CC2431膜塊,ZIGBEEF載調(diào)試板,配套壓力傳感器,US昉真器,PO軟件:IAREmbeddedWorkbenchforMCS-512 .實驗內(nèi)容?閱讀UP-CUPIOT-6410系統(tǒng)ZIGBEE莫塊硬件部分文檔,熟悉ZIGBEE莫塊相關(guān)硬件接口。?閱讀CC2431芯片文檔,熟悉A/D轉(zhuǎn)換的使用及操作。?使用IA研發(fā)環(huán)境設(shè)計程序,利用CC2431的I0斷來監(jiān)測壓力傳感器的狀態(tài)。3 .實驗原理3.1 硬件接口原理ZIGBEE(CC2431暇塊LEDM件接口vnniv1T755BD_RF2AVDDa近L.XR.X士帆ITLH壯丁AVDJ

2、R7】4%3。EEAX-HDVcairQ_n&R口鼻吊門CHFRBAS2dotngvdDVDQP!pTaRFFT.XP(l_口poi心匕4_里1LOJ1iJixpimP】:!,二詈一二MJwnux3jsokB巖一o#o_-Fl-,l.$3一-rlplplplwrI*巴C1HWH2AC一|一等YK圖4.8.1LED硬件接口ZIGBEE(CC2431膜塊硬件上設(shè)計有2個LEDT,用來編程調(diào)試使用。分別連接CC2431的P1_0、P、1_1兩個I0腳。從原理圖上可以看出,2個LED丁共陽極,當P1_0、P1_1引腳為低電平時候,LEW點亮。?壓力傳感器模塊硬件接口丁”一GN口口UTFLT1木口:AD

3、I3LS555GNDC1ND圖4.8.2壓力傳感器硬件接口圖4.8.3ZIGBEE模塊主板J5接口系統(tǒng)配套的壓力傳感器,與ZIGBEE模塊的J5排線相連,這樣我們可以知道,壓力傳感器模塊的輸出與ZIGBEE莫塊的P0_0IO引腳相連。因此我們需要在代碼中將相應(yīng)輸出IO乍為A/D輸入引腳進行設(shè)置,即可來監(jiān)測壓力傳感器或態(tài)。?CC2431相關(guān)寄存器PI1,49。PCrl1BitNameKc5i?tRMDescriptioill7:0Pl7:0CxC:R/WPort1,GeneralpurposeI/Oport,Bi.t-addnessable,表4.8.1P1寄存器P1DIR(OxFE)-Port

4、1DirectionBilNameRmo(R/WDescriptioin7二二三三二一0R/WPi_7UOdiiBctiori0Input1Output6MRF二0R/WPl_fil/Odhroctlon0Input1OutputBDZRP1_S0R/WPl_5I/O看ir&eHortDInput1Output4D工RP1_40R/WP1_4I/OdirectionD加網(wǎng)1Output3MRF二二0FVWPl_3l/Odhroctlon0Input1Output2_)ZRFl_z0FWWPl_2I/OdireetioH0Input1Output1DZRF1_10R/WP1_1lr0direct

5、ion0In網(wǎng)1Output00RJWPI.。l/OdiTBCtioo0Input1Output表41.8.2P1DIR寄存器以上圖表列出了關(guān)于CC2431處理器的P1IO相關(guān)寄存器,其中只用到了P1和P1DIR兩個寄存器的設(shè)置,P1寄存器為可讀寫的數(shù)據(jù)寄存器,P1DIR為IO輸入輸出選擇寄存器,其他IO寄存器的功能,使用默認配置。詳情請用戶參考CC2431的芯片手冊。CLKCON(0xC6|-ClockconirolBitNameHCEfltRMDe&criplioh71R/W32khezdockDsclatorselect-D-32kHzcfysteloscillator1-32kH;RC

6、ctcilla(or6osc1MaindockGSdllarselect:0-32MHzcrystaloscMotor116WHeHRCcsGillalorIiswtongwillonlytakeeifeclwhantheselectedasciliatorIbpojveredup白rdicabc.Ifihuaetecitt;oscillatorianotpeteredup,Ihe1-,yntingIh將卜巾也由pouwaritup.53?ICKSPD2t0I001R/WTineFlicksouutsetlrgcannotbengrsrmans&teniclockseirggivSftbyCS

7、CLrt醫(yī)匕士ingOQO-S2MHzticks001-16MHztidfS010-BMH7beks011-4MHzticks1QO-2MWzbcks101-1M也ticks110-05WHz111-D25Ml-Ulicks2:0CLR/WReserved.AlivsysseiIdOOQ.表4.8.3CLKCON寄存器SLEEP(OxBE)-SleepmodecontrolBilNameRtseLR/WescripLon70RDUnusedeXO=C_TB0RXOSCstdbestatus:0-X0SCisnotpowereduporndtyststable1-XOSCispoweredupa

8、ndstable511FRC_ETB0HFRCOSCBtnblfiBtfltvs:0-HFMCOSCisnotfKiven&dornot為stable1HFRCOSCispcjwe,eaupardslanle4:3於J,;。:XXRStilusbilindicalingttiecfldl;HnftheIa$|If|幅足自侑inUtipl電resets.方eagisterwillonlymntam(helastev8nt00-PowerQHreset01-Exlsrna)0&瓢IQ-Watebdogtirw,eset2OSC-PD0WWHOXOSCartdHFRCOSCdotmeetlirg.T

9、hebitshallbedeared計(heOSCbiti&fcogglad.Also,iftiienei*acalibraHoninprogmsa3MEeCPUattemptstosetThnbitttiemocdbshallupdeDr:inebdonlyat(heendcfcahbration.0-BathcscilwlQFpoweredup1-OscilabarnotstalactedbyOSCbnpowenat!don1力MODE(l:0)00RWSleepmodesettira00-Powermode001-Powermode1ID*Pcvvermode2J1-Pcwarrntid

10、e3表4.8.4SLEEP控制奇存器PERCFG(0xF1)PeripheralControlBitNamseResetR帆Description70RONotused6T1CFG0FLWTimer1UOiQcaMn0Altsmativei1locatio*n1Altsmotive2locatio-n5T3CFG0R/WTlmer3I/OIccstton0Alternative1location1Alternative2locatiDn4T4FG0R7WTimer4I/OIccafion0Allemative1location1Altemativa2locabon3:2DORONotused1

11、U1CFG0R/WSART1I/Olocation0AJEs-maEivg1locatiDn1Al(smativs2I。3Hon0UOCFG0RWSARTOI/Olocation0AlLemativa1location1Alt&mabvE2Iccation表4.8.5PERCFG寄存器U0C5R(0x96)-USART0ControlandStatusBitNameRnsetRAMDMcription一F4COE0RWUSARTspJeGi0SPlmoae1UARTrioce6RE0UAF?receivererable0Recomer日rd31Recehserenabled5SLAVERAWS

12、Pl廿cr,Slavtfrnad-fipciOSima$t0r1SPlslave4FE0RAiwOUARframngerrorsEatu0Noframing,irycotoctod1Byte-recvedwithiriRTgtstqpbitevel*ER年RAiVOARTpailiyirofsiiaLsDNoperilserrorcetected1Byttriect3*edwithpartlyerror2RX_erTE0R/WORec&vptjytestatus0Nobytereseived1ReceiMtwlb/tensEicy1TXBYTE口R/0Tranemnty自ciaiLE0Bt&r

13、ottnenarntted1LjsIb/lev*ri:tentoDetaSulft?regislsrVSTsmlttsi0ACTIVE0RUSART:rarernitroGeicactEtotjs0USART汜您1USARTEjsy巾HirsmtorrpcXvemon0表4.8.6U0CSR寄存器UOGCR(0xU5)-USART0GenericControlBitMamaR詢R/W4&cnpt)on7CFCL0RM/SPldockpobrisyQ網(wǎng)呼k忖厘clackp6削liy1PcsiiieeIdckpalarit/6ZPHA0RAWSPlclock,ph4sB0sOjtpuionwhen

14、SCKgoesfrorrCPOLinvertertoCPOLandrputisJBplsdorWSG-vhen5CKgeesfromCPOLtoCPOLnwjrtoc1DaisoutputonMOS/when5CKgoesfrorrCPOLLoCPOLinterttG.anc匚雙mnput&s3npi由0ra中3。wrenSCago2sfremCPOLirwifld:oCPOL5ORLER0R/W白l(Md材For心門。$GlSSn(st1MSBfnl40Ba2_E;4:C;OkOORMBaude怔exponenlv,umBAUDjE愚幅中HhEAUQMcerdssthsUARTbHL.d舊值

15、用甘SP廠含.就SOKclocMy于表4.8.7U0GCR寄存器UOBUF(OxC1)-USART0Receive/transmitDataBuffer6UNameResetFVWDescription!7:QDATA7:00x00RA/VUSARTreceiveardtransmitdata.WhenwritingihisregisterthedatawrittianisiMittsntotheinternaLtransmitdataregister.Whanreadingthisregister,thedatafromthinternraddataregisterisread.表4.8.8

16、U0BUF奇仔器UOBAUD(0xC2)-USART0BaudRateControlBitNameResetwwDescription7:0:0jOmODRAWBaudratemantissavalue.BAUD_EalongwithBAUD_MdecidestheUARTbaudratetheSPlmasterSCKclockfrequency衣41.8.9U0BAUD寄存器ADCCON1(OxB4)-ADCControl1BitNameResatR?WDescriiptian7wWW0RHGCj1dofcar匕旭口濯已中卜印bothADCHardADCLIms匕qr,i七Ifanecon/

17、arson5cotrcteTeibefore卜珀previoussatanasb*anraadTtreEOCbitwillr#ma巾Ip%0consonrotcofrpflte1consoncompiaST0RM1Starlcorsiscn.Radss1until8M電i&ionhasoamoietsd0nconflftiorma的咕粘1startacorrvstscnuquenoeifADCCOMl.STSEL=ITandno強t)Lr的runrrng.5:4占一一:一11RWStartseva.S&fi-ctswhichavanLthatwillstarta廣扈自8n56當心力Lenos.

18、00ExHrria1tf佻杏.G1Fulspa&d.芻notwarttoringgerfi.10Tirner1dia-nnai0mnnar自自葩利11ADCCON1.ST=13:2S27RL1:aR.WContTcisUia1tfrariomgeralariVrenrttenJC1or-L10,11tiiasortingaulomatiiiyistuTntoW.anocarationhasoorrplatfid.DONormaloprab&ri.(I3xunrolhrl01Clockth#LFSRancamounrolliftg).Smcngfrommodulator.NOTE;TiiflAD

19、Crustterunningrordflrfirt-eSfiQdi門存怕start.Stooped.Rarrdomer&rBtor15turretoff.1:0事11RWRgser應(yīng),Aa/ssetto11表4.8.10ADCCON1寄存器ADCC0N3(0xB6)-ADCControl3atNameRjQS9t圖wneriptiDH7:6三更三I:12:片/wSeiectsreferencevoltagejdfortextra8門ver知on00Internal1.25VrflfarsrcaClExTnalrfifararrcflcmA1N7pmAVDD.SOCpinExtemmrafara

20、rcesnAIN6-AIH7diffarantiaimput文4EDIV;1:OJ二SatstK&sacimaiianml自L姐士brtheoxtr自回?自專曲1.Tn型dKirnatcrrsteais?eternnresth#rssoiutiQraidTimerequirectocoirpiatemecontes4n,0564aecratebft&ra&oiuton)011284然恒的(106gr$oiuiioti)1025Gderate(12bitsresolution)11512dficrata(14bits透印口的?3:0tpurt-01coooRjWExiraibarrei但clSe

21、值h*il白力自r白nurrt?白“ofLhfi自sumconsonthatsoatroutaft白aconversorsequencahasandad.Aslongastnesebitsrennair1stOODC,noxt*aconversion&pe.也rm曲廣.If中西ADCnotrunfimg,writingtot卜舊bitswilljiggerasngiecc?nrsonfrurrtheselectedextrachanreThetktsare3Ltarratcaliyc兩目性Wtreextraoonv&rstrnliasfffiiSh&d.0000AINO00G1AIN10010

22、AIN20011AIN30100AIN40101AINS0110AIN60111AIN?10GCAINOAINI1001AIN2-AIN31010AIN4-AIN51011AINAIN71100GND1101Posrtireference1110Tfinraturs1111VDD/3表4.8.11ADCCON3W存器以上圖表列舉了和CC2431處理器A/D轉(zhuǎn)換操作定相關(guān)的寄存器,其中包括CLKCON!制寄存器,用來控制系統(tǒng)時鐘源,SLEE商存器用來控制各種時鐘源的開關(guān)和狀態(tài)。PERCFG存器為外設(shè)功能控制寄存器,用來控制外設(shè)功能模式。U0CSRU0GCRU0BUFU0BAUD位串口相關(guān)寄存器。ADCCON1ADCCON3另1J為AD專換控制器和AD專換設(shè)置寄存器。3.2 軟件設(shè)計關(guān)鍵源碼分析:設(shè)置CC2430A/D輸入源IO為P0_0,即壓力傳感器的輸出IO:/*函數(shù)功能:初始化ADC入口參數(shù):無返回值:無*說明:參考電壓AVDD,轉(zhuǎn)換對象是P0_0*voidInitialAD(void)(/P1outP1DIR=0x03;LED1=1;LED2=1;/P1控制LED關(guān)LEDP0DIR&=0x01;/P0_0輸入模式ADCCFG|=0x012;/數(shù)據(jù)處理temp1|=temp02;temp0&=0x3f;num=(te

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論