Professional Documents
Culture Documents
Tao Project Dspic
Tao Project Dspic
NguynQuangNam
Tiliu:
TUT01.01
Ngy:
3/8/2006
Trang:
1/6
Tutorialno01.01
Gin:
onHip,www.picvietnam.com
Nidung:
TomtprojectlptrnhhpngvidsPIC
MICROSOFTWORD
Tmtt:
HngdnccbctomtprojectvbindchmtprojecttrongMPLABIDEvitchng
trnhchodsPICbnghpng(assemblylanguage).
1.
Giithiu
KhivitchngtrnhchodsPICsdngmitrngMPLAB,nhiuthngtinthitlp
chocccngviclinquancttrctrongMPLAB,nhmgipchoMPLABqunl
cvicvitchngtrnh,bindch,mphng,npchngtrnhvochipmtcch
thngnht.
TiliunyshngdnbntomtprojecttrongMPLABsdngASM30vit
chngtrnhchodsPIC.Bncngschngdncchbindchprojectctora
vcchxlkhivicbindchcli.
2.
Ccquyctrongtiliu
Mt
FontPalatinoLinotype:
Vithoachu
Biuth
Vd
Chnmtmenu
chnProjectWizard
Mttntrngtrongca Saveprojectbefore
ttrongdunhykp
shayhpthoi
build
Vnbngchchn,in
ngdnmenu
File>Save
nghingvidu>
NhnNext
Mtntnhn
Inm
ChnthPower
Mtth(hpthoi)
Vnbngiaccdu
Mtphm(bnphm)
Nhn<Enter>,<F1>
ngocnhn<>
FontCourierNew:
Example.s
Courierthng
Mngun
Tntptin,ngdn D:\Microchip\
mov #0x8010, W0
Tkha
pic30-as -version
Tychndnglnh
Ngiboco:
NguynQuangNam
Tiliu:
TUT01.01
Ngy:
3/8/2006
Trang:
2/6
3.
Hngdncchtomtprojectmi
3.1.
ThitlpmitrngMPLAB
GisMPLABIDEccittrongmytnhcabn,chngtacnmbol
cccngcngnngcMPLABnhndinng.y,chngtassdnghpng
vitchngtrnhchodsPIC,docnphimbobcngcASM30Toolsuitec
chntrongMPLABIDE.Nubnthchinvicnyttrc,bncthbquabc
ny,vtheoditbcthhai,ChyProjectWizard.
1. TthanhmenucaMPLAB,chnProject>SetLanguageToolLocationsmhp
thoit/kimtravtrcctptinthcthicabcngcngnng.
Hnh3.1:Hpthoithitlpvtrcccngcngnng
2. Tronghpthoi,diRegisteredTools,chnMicrochipASM30Toolsuite.
Nhnvo+mrng.
3. ChnExecutables.Nhnvo+mrng.
4. ChnMPLABASM30Assembler(pic30-as.exe).TikhungLocation,mt
ngdnngchotptinthcthicnchinth.Nukhngcngdn
nochinth,bnhynhpvongdnhayduytthmcnctp
tinny.
Ngiboco:
NguynQuangNam
Tiliu:
TUT01.01
Ngy:
3/8/2006
Trang:
3/6
5. ChnMPLABLINK30ObjectLinker(pic30-ld.exe).TikhungLocation,
mtngdnngchotptinthcthicnchinth.Nukhngcng
dnnochinth,hythchintngtnhtrn.
6. ChnLIB30Archiver(pic30-ar.exe).TikhungLocation,mtngdn
ngchotptinthcthicnchinth.Nukhngcngdnnochin
th,hythchintngtnhtrongbc4.
7. NhnntOK.
NhvychngtathitlpxongbcngcngnngtrongMPLABchoprojectk
tipcachngta.
3.2.
ChyProjectWizard
TrongmitrngMPLAB,chnlnhmnuProject>ProjectWizardmwizard.Nhn
vontNext>mnhnhchomng.
1. ChndsPIC4012trongdanhschthxungDevice.NhnntNext>tiptc.
(TichndsPIC4012chocctutorialvylchipdnhchoiukhinngc,c
schndngchonhiungdng,chnhlviiukhincnthitchoccng
dngiukhinngc,lmrbtchnghn).
2. mctrcchngtathitlpcccngcngnng,doyccbnchcn
kimtraliccthitlp.Tuynhin,nubnchathitlpbcngcngnngth
ylchibnlmiu.HymboActiveToolsuitecchnl
MicrochipASM30Toolsuite,saubnhykimtraccvtrcacctrnhhp
dch(assembler),trnhlinkt(linker),vtrnhqunlthvin(archiver)lng,
tngtnhmc3.1.NhnntNext>sangbcktip.
3. Bnhychnchoprojectcamnhmtcitn,chnghnnhVidu,sauhy
nhnvontBrowsechnvtrtproject.NhnvontNext>khibnhon
ttvicttnvchnvtrchoproject.
4. bcny,bnsthmcctptincnthitvoproject.Thamkhohnhminhha
phadi.
a. Tronghpduytthmcbntricahpthoi,chnthmccchatptinm
ngun(cphnmrngl.s).Tronghnhminhho,tichntptinVidu.s
thmvoproject(bngcchnhnvontAdd>>.
b. Vntronghpduytthmc,bnhytmnthmccitcaMPLAB(vd,
trongmycatilD:\Microchip\),saudngccdu+mrngng
dnsauy:MPLAB ASM30 Suite\Support\gld.Bnhychntptin
p30f4012.gld,ychnhlkchbnlinktchochipdsPIC4012angcs
dngtrongproject.NhnvontAdd>>thmtptinnyvoproject.
Ngiboco:
NguynQuangNam
Tiliu:
TUT01.01
Ngy:
3/8/2006
Trang:
4/6
Hnh3.2:Hpthoithmcctptinvoproject
c. Hynhduchnchocchpchn(checkbox)bncnhcctptinchp
chngvothmccaproject.(Cctptingcvncginguyn).Nhnnt
Next>tiptc.
Hykimtralithngtintmttchoproject,nucsaistthbncthdngnt
<Backquaylichnhsa.NhnntFinishshonttvictovthitlpproject.
Hnh3.3:Cascyqunltptincaproject
KhiProjectWizardhontt,casProjecthnscmtcyqunltptinnh
hnhminhhaphatrn.Tncakhnggianlmvic(workspace)lVidu.mcw,tn
Ngiboco:
NguynQuangNam
Tiliu:
TUT01.01
Ngy:
3/8/2006
Trang:
5/6
caprojectlVidu.mcp,vttccctptincaprojectclitkdiloitptin
tngngcachng(.incchocctptingp,.gldchocckchbnlinkt).
3.3.
Thitlpcctychnbindch
BnchnlnhmnuProject>BuildOptions>ProjectmhpthoiBuildOptions.
1. NhpvothGeneral.Bnhychobitngdncacctptingpbndi
khungAssemblerIncludePath,$(AINDIR):,bngcchnhptrctiphocdng
ntBrowse...tmnngdn.Vd,trongmycatingdnsl:
D:\Microchip\MPLAB ASM30 Suite\Support\inc\
2. NhpvothMPLABASM30.ChnDiagnosticstrongdanhschthxung
Categories,nhdumcEnableListingbndiListingOptions.
3. NhpvothMPLABLINK30.ChnDiagnosticstrongdanhschthxung
Categories,nhdumcGeneratemapfilevGeneratecrossreferencefile
bndiGenerateCommandLine.
4. NhpvothASM30/C30Suite.Vi(AllOptions)cadanhschCategories,
mbolCOFFcchnlmdngtptinxutra.CngkimtralBuild
normaltarget(invokeLINK30)cchnphnTargetType.
5. NhpvontOKphadihpthoichpnhnccthitlpbindchv
nghpthoi.
6. ChnlnhmnuProject>SaveProjectlucuhnhhinticaprojectVidu.
3.4.
Bindchproject
BnchnlnhmnuProject>BuildAllbindchprojecthinthi.(Bncthnhp
chutphivotncaproject,Vidu.mcp,trongcyqunltptincaproject,v
chnBuildAlltmnugiln.
CasOutputhnxuthinkhibindchxong,vhinthktqubindch,nh
tronghnhminhhadiy.Vdtrnhnphicbindchthnhcng,nubn
theongnhngbchngdn,vsdngtptinmngunikmbihng
dnny.
Nuvicbindchkhngthnhcng,hykimtranhngphnsau:
1. Xemliccbctrctrongbihngdnny.Hymbolbnthitlp
cccngcngnngchnhxcvcttccctptincaprojectvccthitlp
bindchng.
Ngiboco:
NguynQuangNam
Tiliu:
TUT01.01
Ngy:
3/8/2006
Trang:
6/6
Hnh3.4:CasOutputangthhinthngtincavicbindchproject
2. Nubnsamnguncavd,hyxemtrongnhnBuildcacasOutputv
cclicphptrongmngun.Nuc,bnnhpchutkpvolindng
mngunchali.Hysali,vsauthbindchli.
4.
Ktlun
TiliunyhngdncchtolpmitrnglptrnhchodsPICbnghp
ngtrongMPLABvccvnlinquan.MPLABcncthitlpchnhxccth
tmcccthngtincnthitvmngun,ccthvincngnhcccngcngnng,
nhmmbovicbindchmtchngtrnhdinrasuns.Khibnchphiquan
tmnvicthhinchngtrnhtheongthitk.