0% found this document useful (0 votes)
28 views52 pages

Mplab c18 Setup

This document provides instructions for setting up Microchip MPLAB and the C18 compiler to develop and run programs on a PIC18F1320 microcontroller. It describes installing the MPLAB IDE software, creating a new project for the PIC18F1320, configuring compiler and debugger settings, building and running the project in simulation, and debugging and running the compiled program on the actual PIC18F1320 microcontroller hardware using a PICkit 2 programmer.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views52 pages

Mplab c18 Setup

This document provides instructions for setting up Microchip MPLAB and the C18 compiler to develop and run programs on a PIC18F1320 microcontroller. It describes installing the MPLAB IDE software, creating a new project for the PIC18F1320, configuring compiler and debugger settings, building and running the project in simulation, and debugging and running the compiled program on the actual PIC18F1320 microcontroller hardware using a PICkit 2 programmer.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 52

UniversityofFlorida ElectricalandComputerEngineering EEL3923&EEL4924

MicrochipMPLABandC18compilersetup.


StarttheMPLABsetupprogram.

Clicknext.

Acceptandclicknext.

Clicknext.

Clicknext.

Clicknext.

Clicknext.

Clicknext. Thesoftwarewillnowinstall.

ClickNo.

ClickNoandthentheFinishbutton,wewillrestartlater.

Nextwewillinstallthecompiler.NavigatetotheMPLABC18Litedirectoryandstarttheapplication.

ClickNext.

SelectIAcceptandclicknext.

Clicknext.

ClickNext.

Selectallfourboxesandclicknext.

Selectallfourboxesandclicknext.

Clicknext. Thesoftwarewillnowinstall.

NextclickFinish. Unselecttheboxesyoudontwanttoopenandread.

Nowreboot.

Afteryouloginthiswindowwillpopup. Youcanjustcloseit.

ClickthisicontostartMPLABIDE.

Thesoftwareisnowinstalled. Thenextsectionwillcoverthesetting upandbuildingofanewproject.

Thisiswhatyoushouldseewhentheprogramstarts.

InthetoolbarselectProjectandthenProjectWizard.

ClickNext.

SelectPIC18F1320.

MakesurethattheActiveToolsuiteisMicrochipC18Toolsuite.

Alsomakesurethatthetoolsuitecontentsandthelocationsmatch. ClickNext.

NextSelecttheProgrambuttonfromthetoolbarandclickonProjectwizard. Enterthenameofyourproject.18F1320Wizardinthiscase.

YoucanalsoselecttheprojectlocationwiththeBrowsebutton.

Thisiswhereyoucanaddyourmain.cfile.

ThisistheMain.cfilethatisusedforthisexample.

Youmustalsoaddthelinkerfiletomatchyourprocessor.

Inthiscaseitisa18F1320.Afterclickingthe18F1320_gfileclickAdd.

ClickFinish.

NextselecttheProjecttoolboxandthenselecttheSetLanguageToolLocationstool.

SelecttheMicrochipC18Toolsuitetoolbox.

Opentheexecutablesbox.

Checkthattheexecutablesarepointedtothecorrectlocationsasabove.

NextselecttheprojecttoolandthenselecttheBuildOptionsProject.

NowselecttheDirectoriestab.ThenselecttheIncludeSearchPathinthedropdownbox.Nextclick new.

ClickthisbuttontoopenuptheDirectorytoselectthefiles.

Setthesearchpathfortheincludeandthelibrarytomatchtheabove. ClickapplyandthenOK.

ClicktheBuildAllbuttonshownabove. Thiswillbuildandcompileyourproject.

ThelastlineintheoutputboxshouldreadBUILDSUCCEEDED.

SelecttheDebuggertool_SelectTool_4MPLABSIMasabove.

SelecttheViewtoolandthenselecttheWatchoption.Thiswillopenanewwindow.

Inthewatchwindowyoucanselectthesymbolsectionandselectavariabletomonitor.Xhasbeen selectedhere.AfterthevariableisselectedclicktheAddSymbolbutton.

InthewatchwindowyoucanselecttheSFRsectionandselectaSFRtomonitor.PortBhasbeen selectedhere.AftertheSFRisselectedclicktheAddSFRbutton.

Onthetopofthepagefindtherunbuttonandclickit.

Pausethesim.Youshouldbeabletoseeyourportandvariabledatainthewatchwindow.

NextselecttheDebuggertoolandclickthesettingsbutton.

ClicktheUART1IOtabandsettheboxesasshownabove.ThiswillroutetheprintfdatatotheOutput screen.

Runningyourprogramonyourtargetdevice.

SelectthedebuggertoolandclickonSelectDeviceandthen7PICkit2.

Selectthedebuggertoolagainandthenclickthesettingsbutton.

Adjustyoursettingstomatchtheabovewindow.

Yourprogramshouldberunningonyourhardwarenow.

Ifyourightclickinyourmain.cwindowyoucansetabreakpoint.

YouwillseearedcirclewithaBmarkingthebreakpoint.Theprogramwillrununtilitreachesthis pointandthenitwillstop.Tocontinueclicktherunbuttonagain.

YoucansinglestepyourprogrambypressingthestepIntobuttonhere.

You might also like