MPLAB軟件調(diào)試技巧_第1頁
MPLAB軟件調(diào)試技巧_第2頁
MPLAB軟件調(diào)試技巧_第3頁
MPLAB軟件調(diào)試技巧_第4頁
MPLAB軟件調(diào)試技巧_第5頁
已閱讀5頁,還剩10頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡介

1、MPLAB軟件仿真調(diào)試步驟1、點(diǎn)解Debugger下的MPLABSIM選項(以下均用紅框表示):Hlight-MPLABIDEvS.50FileEditViewProject(DebuggerProgrammerToolsConfigureWindowHellight.mcwlight.mcp白匚JSourceFiles:圍light,c!_JHeaderFiles!_JObjectFiles!_JLibraryFiles(JOtherFiles2、出現(xiàn)仿真相關(guān)按鈕SelectToolNone1ProteusVSM2MPLABICD23PICkit34MPLABSIM5REALICE6MPLA

2、BI匚DV7PIC32StarterKit8StarterKiti匚lErMemory3、在要設(shè)置斷點(diǎn)的地方雙擊,出現(xiàn)斷點(diǎn):D國D國%網(wǎng)(=)HIlight-MPLABIDEv6.50FileEdit(ViewProjectDebuggerProgrammerToolsConfigureWindowHelpfijlight-MPLABIDEv8.50FileEditViewProjectDebuggerProgrammerToolsConfigureWindowHelpLED2_0N();delay(10000);LED2OFF();Output4、如下圖找到SFR/PeripheralsLE

3、D3_ON();delay(10000);LED3_OFF();LABIDEEditorMPIBSIMlight.mcwlight.mcp白匚JSourceFiles:圍light,c!_JHeaderFiles!_JObjectFiles!_JLibraryFiles(JOtherFilesFjMPLABIDEEditorHardwareStackLCDPixelLocals1MemoryUsageGaugePORTBCLR|=(110)|(111:while(1)PORTBCLR|=(110)|(111:while(1)DisasEemblyListingEEPROMFileRegiste

4、rsFlashDataMemoryProgramMemorySpecialFumctionRegistersWatchChecksunLED1_ON();delay(10000);LED1OFF();lightmewToolbarsLED1_ON();delay(10000);LED1OFF();LED2_0N();delay(10000);LED2OFF();LED3_ON();delay(10000);LED3OFF();LED4_0N();delay(10000);LED4OFF();VProject7OutputCPURegistersCallStackSimulatorTraceSi

5、mulatorLogicAnalyzerSFR/PeripheralsBuildVersionControlFindinFilesDebugDebugChecksunLoadedD:ProgramFilesHI-TECHSoftwareP5、出現(xiàn)如下面的框(位置可能不一樣)(I10)Ilight-MPLAEIDEv8.50-MPLABIDEEditor3FileEditViewProjectDebuggerProgrammerToolsQ為電呂開W矍SFR/PeripheralsDebuqNameHexintmainvoid)BF800000WDTCONJX0000007CBF30Q2QQRT

6、CCONDxOOOOOOOOEF000210RTCALRM3x00000000BFS0220RTCTIMEDxQOQQOQQOBF30230RTCDATEDxQQQQQQQOEF000240ALRMTIME3x00000000BFS0250ALRMDATEDxQOQQOQQOBF30aeoaT1CONDxQQQQQQQOEF000610TMRl3x00000000BFS0Q62QPR13X0000FFFFBF30asoa12CONDxQQQQQQQOEF000810TMR23x00000000BFS082aPR23X0000FFFFBF30aoa13CONDxQQQQQQQOEF000A10T

7、MR33x00000000BFS0QA20PR33X0000FFFFBF30ocoo14CONDxQQQQQQQO=點(diǎn)擊亍運(yùn)行程序運(yùn)行到斷點(diǎn)處:工;二light-MPLABIDEv8.50-MPLABIDEEditorFileEditViewProjectDebuggerProgTRISBCLRPORTBCLR|=(110)|(1LE,D1_ON();delay(10000);LE,D1_OFF();LE,D22ON();delay(10000);LE,D2_OFF();LE,D3_ON();(I10)I:+::+::*:+:+:+:+::+::*:+:Bui1dsuecessful!:+:+

8、::+::*:+:+:+:+::+::*:usedusedProgr:iJTLjTLejTLurrDataiTLeiTLoryVirtualrHex*口七mainvoid)SFRtPeripherals3FSB52C0U1BDTP23x00000000BF3852D0U1BDTF3DxOOQQQQQOBF3852E0U1CNFG1DxOOQQOQQO3FSB5300U1EP03x00000000BF385310U1EP1DxOOQQQQQOBF385320U1EP2DxOOQQOQQO3FSB5330U1EP33x00000000BF385340U1EF4DxOOQQQQQOBF385350U

9、1EF5DxOOQQOQQO3FSB5360U1EP63x00000000BF385370U1EP7DxOOQQQQQOBF3853S0U1EP8DxOOQQOQQO3FSB5390U1EP93x00000000BF3853AOU1EP10DxOOQQQQQOBF3853B0U1EP11DxOOQQOQQO3FSB53C0U1EP123x00000000BF3853D0U1EP13DxOOQQQQQOBF3853E0U1EP14DxOOQQOQQO3FSB53F0U1EP153x00000000BF38eooaTRISA3XOOOOC6FFBF38eoiaFORTADxOOQQOQQO3FSB

10、6020LATA3x00000000BF386030ODCADxOOQQQQQOBF386040TRISB3XOOOOC3FF3FSB6050P0RT33x00000000BF386Q-6QLATBDxOOQQQQQOI-bTTrrn-.y./.-.y./.-.y.TRISBCLRPORTBCLR|=(110)|(1LE,D1_ON();delay(10000);LE,D1_OFF();LE,D22ON();delay(10000);LE,D2_OFF();LED30N();delay(10000);LE,D3_OFF();LED40N();delay(10000);LE,D4OFF();Bu

11、ildVersionControlFindinFilesMPLABSIMOutput412tnrtes*0tnrtesS3light-MPLABIDEv8.50-MPLABIDEEditor3FileEditViewProjectDebuggerProgrammerTools匚onfigureWindowHelpLo且d已dD:.PruraniFilesHI-TECHSoftwareF17、再次點(diǎn)擊運(yùn)行,程序停到第二個斷點(diǎn)處,此時可以看到LATB變紅(紅色表示該項發(fā)生了變化),且其值為0 x0000040(運(yùn)行了LED1_ON()語句,在開頭有其定義為:#defineLED1_ON()LATB

12、SET=(1.yt.ny.nny.Output2S1BuildVersionControlFindinFilesMPLABSIMProgr:iJTLjTLejTLurr口邑已d412brtesDataiTLeiTLoryused0brtesintmainvoid)TRISBCLR|=(110)|PORTBCLR|=(110)|(1while(1)LED1_ON();delay(10000);LED1_OFF();LED22ON();|delay(10000);LED2_OFF();LED30N();delay(10000);LED3_OFF();LED40N();delay(10000);LE

13、D4_OFF();Load已dD:VProgrLFilesHI-TECHSuftwareP接下來介紹如何用軟件仿真看延時1、點(diǎn)擊resetS3light-MPLABIDEv8.50-MPLABIDEEditor3FileEditViewProjectDebuggerProgrammerToolsConfigureWindowHelp(I10)I13FileEditViewProjectD亡buggerProgrammerToolsConfigureWindowHelpSFRtPeripheralsBFS8_52C0U1BDTP23x00000000EFSS52D0U1BDTP3DxOQQQQQ

14、QQBF8852EQU1CNFG13xQ0QQ0QQ0BFSS5300U1EP0DxOQQQQQQQEFSS5310U1EP1DxOQQQQQQQBF885320U1EP23xQ0QQ0QQ0BFSS5330U1EP3DxOQQQQQQQEFSS5340U1EP4DxOQQQQQQQBF885350U1EP53xQ0QQ0QQ0BFSS530U1EP-6DxOQQQQQQQEFSS5370U1EP7DxOQQQQQQQBF885380U1EP83xQ0QQ0QQ0BFSS5390U1EP9DxOQQQQQQQEFSSU1EP10DxOQQQQQQQBF8853BQU1EP113xQ0QQ0QQ

15、0BFSSsacaU1EP12DxOQQQQQQQEFSS53D0U1EP13DxOQQQQQQQ巡U1EP14Watch:F3xQ0QQ0QQ03x00000000light-MPLABIDEv6.50-MPLABIDEEditorTRISBCLRPORTBCLR|=(110)|(1LED1_ON();delay(10000);LED1_OFF();LED22ON();delay(10000);LED2_OFF();LED30N();SFR/PeripheralsVirtualrNaiu.e3FSB52C0U1BDTP.2BF8852D0U1BDTP3BFS852E0U1CNFG13FSB5

16、300U1EP0BF885310U1EP1BFS85320U1EP23FSB5330U1EP3BF885340U1EF4BFS85350U1EP53FSB5360U1EP6BF885370U1EP7BFS85380U1EP83FSB5390U1EP9BF8853AOU1EP10BFS853B0U1EP113FSB53C0U1EP12BF8853D0U1EP13BFS853E0U1EP143FSB53F0U1EP15BF886000TRISABFS86010PORTA3FSB6020LATABF886030ODCABFS86040TRISB3FSB6050PORT3BF886Q6QLATBI-b

17、TTrrSelectTool卜ClearMemoryRuihjreAnimateHailtF5StepIntoF7StepOverF8StepOilResetBreakpointF2StopWatchStimulusProfileClearCodeCoverageSettings“3x000000003x00a0CFFDxooaooaoo_JxOOQOOQOODxooaooaoop3X0000FFFFJxOOQOOQOO3x00000000庁嗨劭網(wǎng)1Checksun口七main(void:ITRISBCLR|=(110)|PORTBCLR|=(110)|(1while(1)iLED1ON();

18、delay(10000);LED1OFF();LED2_ON();|delay(10000);LED2OFF();LED3_ON();delay(10000);LED3_OFF();LED4ON();delay(10000);LED4_OFF();OutputBuildVersionControlFindinFilesMPLABSIMProgr:iJTLjTLejTLurr口邑已d412brtesDataiTLeiTLoryused0brtesS3light-MPLABIDEvS.50-MPLABIDEEditor3FileEditViewProjectDebuggerProgrammerTo

19、olsConfigureWindowHelp3、調(diào)出界面如下S3light-MPLABIDEvS.50-MPLABIDEEditor3FileEditViewProjectDebuggerProgrammerToolsConfigureWindowHelpS3light-MPLABIDEvS.50-MPLABIDEEditor3FileEditViewProjectDebuggerProgrammerToolsConfigureWindowHelpSFRtPeripheralsBFS8_52C0U1BDTP23x00000000EFSS52D0U1BDTF3DxOQQQQQQQBF8852EQ

20、U1CNFG13xQ0QQ0QQ0BFSS5300U1EP0DxOQQQQQQQEFSS5310U1EP1DxOQQQQQQQBF885320U1EP23xQ0QQ0QQ0BFSS5330U1EP3DxOQQQQQQQEFSS5340U1EF4DxOQQQQQQQBF885350U1EP53xQ0QQ0QQ0BFSSU1EP-6DxOQQQQQQQEFSS5370U1EP7DxOQQQQQQQBF88sssaU1EP83xQ0QQ0QQ0BFSS5390U1EP9DxOQQQQQQQEFSSU1EP10DxOQQQQQQQBF8853BQU1EP113xQ0QQ0QQ0BFSSsacaU1EP

21、12DxOQQQQQQQEFSS53D0U1EP133x00000000TRISBCLRPORTBCLR|=(110)|(1(110)LE,D1_ON();delay(10000);LE,D1_OFF();le,d22on();delay(10000);LE,D2_OFF();LE,D3_0N();Lu日ci已dD:.Progr:ajTLFilesHI-TECHSuftwarePI5、在其中填入你實際用到的時鐘:SimulatorSettings(I10)ITRISBCLRPORTBCLR|=(110)|(1(1)EFS8_53A0BFSSSSBaBFS853COEFS8_53DQU1EP10

22、U1EP11U1EP12U1EP13默認(rèn),查看deDxooaooaoojxooaooaooDxooaooaooDxooaooaoo時。S8light-MPLABIDEv6.50-MPLABIDEEditor可FileEditViewProjectDebuggerProgrammerTools匚cnfigureWindowHelpLED1_ON();delay(10000);LED1_OFF();();delay(10000);LED2_OFF();LED3ON();二1accccxDebug寸口sry劭網(wǎng)|ChecksunSFR/Peripherals3FSB52C0U1BDTP23x0000

23、0000BF3852D0U1BDTF3DxOOQQQQQOBF3852E0U1CNFG13x000000003FSB5300U1EP03x00000000BF385310U1EP1DxOOQQQQQOBF385320U1EP23x000000003FSB5330U1EP33x00000000BF385340U1EF4DxOOQQQQQOBF385350U1EF53x000000003FSB5360U1EP63x00000000BF385370U1EP7DxOOQQQQQOBF385380U1EP83x000000003FSB5390U1EP93x00000000BF3853A0U1EP10Dx

24、OOQQQQQOBF3853B0U1EP113x000000003FSB53C0U1EP123x00000000BF3853D0U1EP13DxOOQQQQQOBF3853E0U1EP143x000000003FSB53F0U1EP153x00000000BF386000TRISA3XOOQQC6FFBF386010PORTA3x000000003FSB6020LATA3x00000000BF386030ODCADxOOQQQQQOBF386040TRISBx0000C3FF3FSB6050PORT33x00000000BF386Q-6QLATB3x00000400I-bTTrrnjrtiyi

25、.jrtiyi.ji-yi.yi.VirtualrNaineTRISBCLR(110)|PORTBCLR|=(110)|(1while(1)LED1_ON();delay(10000);LED1_OFF();LED22ON();delay(10000);LED2_OFF();LED3ON();delay(10000);LED3_OFF();LED4ON();delay(10000);LED4OFF();BuildVersionControlFindinFilesMPLABSIMOutputCumparativein已jncjiryusage:Progr:iTTLin已iTLijryusedDa

26、tajtl已moryusedStopwatch412bytesUbyt已m.I.I.I.i.i.i.i.i.P;m1o11i=i-ro-p111I-1-1-X-X-1-1-1-1-X-X-Zero49490.6125000.612500StopwatchTotalSimulatedSynuhInstructionCyclesTime:uSeuw80.000000ProcessorFrequencyMHz1S3light-MPLABIDEv8.50-MPLABIDEEditor3FileEditViewProjectDebuggerProgrammerToolsConfigureWindowHe

27、lpLu日ci已dD:.Progr:ajTLFilesHI-TECHSuftwarePI7、單擊Zero將時間清0;Q為電呂開W矍SFR/PeripheralsDebugcIChecksunintmain(void;BFS8_52C0U1BDTP23x00000000EFSSU1BDTF3DxOOQQQQQOBF8852EQU1CNFG13x00000000BFSS5300U1EP03XQ0QQ0QQ0EFSS5310U1EP1DxOOQQQQQOBF885320U1EP23x00000000BFSS5330U1EP33XQ0QQ0QQ0EFSS5340U1EF4DxOOQQQQQOBF885

28、350U1EP53x00000000BFSSU1EP-63XQ0QQ0QQ0EFSS5370U1EP7DxOOQQQQQOBF885380U1EP83x00000000BFSS5390U1EP93XQ0QQ0QQ0EFSSU1EP10DxOOQQQQQOBF8853BQU1EP113x00000000BFSSsacaU1EP12DxQOQQOQQOEFSS53D0U1EP133x00000000VirfjslrNameHexTRISBCLRPORTBCLR|=(110)|(1while(1)(I10)|冃時間了。LED1_ON();delay(10000);LED1_OFF();LED2ON();delay(10000);LED2_OFF();LED3ON();aFTCCCCh可FileEditViewProjectDebuggerProgrammerToolsConfigureWindowHelpfl|light-MPLABIDEv6.50-MPLABIDEEditor(I10)ISFRtPeripherals3FSB52C0U1BDTP23x00000000BF3852D0U1BDTF3DxOOQQQQQOBF3852E0U1CNFG13x000000003FSB5300U1EP03x00000000BF3853iaU1EP1DxOOQQQQQOBF385320U1EP2

溫馨提示

  • 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)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論