Anda di halaman 1dari 13

Software KeiluVisio onIDE

uVision ID DE (Integrated Develop pment Envir ronment) allows develo opers to crea ate embedde ed applicatio ons using the Keil development too ols. It integra ates a projec ct manager (to create a and maintain projects), , make utilit ty (for assem mbling, com mpiling, and linking emb bedded applications), s source code vironment. editor, de ebugger and d simulator into one env

FlashMag gic p gflashbasedmicrocontrolllers Atoolforprogramming

Keil uVision IDE

KeilSoftw wareDevelop pmentCycle Theprojectdevelopme entcycleissimilartoanyother o softwar redevelopme entproject. mtheDeviceD Database,and dconfigureth hetoolssettings 1.Createaproject,selectthetargetdevicefrom nC 2.Createsourcefilesin pplicationwit thProjectMa anager 3.Buildap 4.Debugandcorrecterrors e insourc cefiles,verify yandoptimiz zeapplication n 5.Downlo oadcodetoFlashROMorSRAMandte estthelinked application

es Procedure 1. CreateDirecto ory 2. CreateNewPr roject 1. LaunchKeiluVisionIDEbyclickingontheiconon nyourdesktoporbyselect tingitfromth he StartMenu u. Createaworki ingdirectory, ,suchasC:\SITEProgram\ \UVProject,t tosaveallyou urwork. Th hisdirectorywillincludethefollowingfiles: f *.uvpr rojthemain nprojectfileto t managealllfilesassociatedwithcurr rentproject *.cCcode;aninp puttotheuVisionIDEprog gram *.hexcontainsma achinecode;anoutputfro omuVisionID DEprogramth hatisdownlo oaded tothemicroprocessorboard

2. Tocreateanewprojectfile,clickonProjectfromthemenubarandselectNewuVision Project.UndertheCreateNewProjectwindow,giveyourprojectanameandsaveitinthe folderyoucreated.

3. SelectthedevicetypebyexpandingNXP(foundedbyPhilips)andchoosingLPC2148.Notice thatthedescriptionsectionlaysoutthedetailsoftheLPC2148microcontroller,including theonchipperipheralsandmemoryoptions.ClickOK. (ThisstepisveryimportantsinceuVisioncustomizesthetoolsettings,peripherals,and dialogsforthatparticulardevice.)

**YoumayinvokethisscreenthroughthemenuProject>SelectDeviceforTarget Menuinordertochangethedevicetype. 4. Adialogboxwillappearaskingifyouwanttoincludeastartupcodeforthisdevice.ClickYES. (Allembeddedprogramsrequiresomekindofmicrocontrollerinitializationorstartupcode. Thestartupcodespecifiesthestartingconfigurationofyourhardware.AllKeiltoolsinclude chipspecificstartupcodeformostofthedeviceslistedintheDeviceDatabase.) 5. Onceyouhavecreatedanewprojectsuccessfully,theProjectWindowshowsthetargets, groups,andfilesofyourproject.Bydefault,thetargetnameissettoTarget1,whilethe groupsnameisSourceGroup1.

3. CreateSourceFiles Sourcefilesare 1. Tocreateanewsourcecode,usethebuttonontheFileToolbarorclickonFileinthe menubarandselectNew.ThisactionopensanemptyEditorWindowtoenteryour sourcecode. 2. TypeinyourClanguagecode.(Note:SeeCProgramming) 3. SavethenewsourcefileusingthebuttonontheFileToolbarorclickonFileinthemenu barandselectSave. 4. AddSourceFiles 1. IntheProjectWindow(ontheleft),expandtheTarget1folder.RightclickontheSource Group1folder,thenchooseAddFilestoGroupSourceGroup1.

2. Selectthesourcefile(.cfile)youjustcreatedandsaved.ClickAddandthenClose.

5. Compiling ThecompilerallowsyoutowriteintheClanguageandcompilecodetorunontheLPC2148 microcontroller. 1. First,youneedtosettheoptiontocreateaHEXfilebyclickingonProjectfromthe menubarandselectingOptionsforTargetTarget1.

2. OntheOutputTab,checktheoptiontoCreateHEXFile.ClickOK.

3. ClickonProjectfromthemenubarandselectBuildTargetorRebuildalltargetfiles.A BuildOutputwindowwillshowthesourcecodegettingcompiledintoaHEXfile.

4. IntheBuildOutputWindow,amessageof0Errorsand0warningssignifiesthatyour programcompiledsuccessfully.(Warningsdonotpreventtheprogramfromrunning correctly.However,youshouldconsidersolvingthemtoeliminateunwantedeffects).

6. DownloadingProgramtoMicrocontroller Weneedtodownloadthemachinecode(HEXfile)intothephysicalmemorylocationsofthe microcontroller. SettingOptions 1. SelectFlashfromthemenubarandclickonConfigureFlashTools.OntheUtilitiestab, chooseUseExternalToolforFlashProgramming.Inthecommandline,select FlashMagic.exe.

2. IntheArgumentsline,modifytheCOMportnumbersothatitcorrespondstotheport numberassignedbytheWindowsDeviceManager. TofindtheCOMportnumber,followthesesteps: 1. ClickonStartinthelowerleftcornerofyourPCscreen.Then,clickonControlPanel. 2. GotoHardwareandSound.UnderDevicesandPrinters,selectDeviceManager.A dialogboxwillpopup.ClickOK. 3. IntheDeviceManagerWindow,expandPorts(COM&LPT)toseetheportnumber oftheUSBconnectionthatisconnectedfromthemicrocontrollertothePC.

4. OntheTargettab,checkUseMicroLIB.

DownloadingProgram TheprogramwillbedownloadedtothemicontrollerusingFlashMagic.FlashMagicisautilityto downloadtheHEXfiletotheLPC2148processor.

1. ClickonFlashfromthemenubarandselectDownload.Waittillthedownloading processisfinished.

2. InFlashMagic,selectLPC2148asthedevice,thecorrectCOMportnumber,BaudRateof 9600,None(ISP)forInterfaceand12MHzforOscillator.Then,checkEraseblocksused byHexFile.

3. SelecttheHEXfilethatwasjustcreatedbyclickingBrowse.Then,clickStart. 4. TheprogramwillbedownloadedtotheonchipFLASHmemorywhenFinishedis displayedinthestatusboxatthebottomofthewindow.

Anda mungkin juga menyukai