毕业设计外文翻译Word文件下载.docx

上传人:b****2 文档编号:3213405 上传时间:2023-05-01 格式:DOCX 页数:23 大小:30.39KB
下载 相关 举报
毕业设计外文翻译Word文件下载.docx_第1页
第1页 / 共23页
毕业设计外文翻译Word文件下载.docx_第2页
第2页 / 共23页
毕业设计外文翻译Word文件下载.docx_第3页
第3页 / 共23页
毕业设计外文翻译Word文件下载.docx_第4页
第4页 / 共23页
毕业设计外文翻译Word文件下载.docx_第5页
第5页 / 共23页
毕业设计外文翻译Word文件下载.docx_第6页
第6页 / 共23页
毕业设计外文翻译Word文件下载.docx_第7页
第7页 / 共23页
毕业设计外文翻译Word文件下载.docx_第8页
第8页 / 共23页
毕业设计外文翻译Word文件下载.docx_第9页
第9页 / 共23页
毕业设计外文翻译Word文件下载.docx_第10页
第10页 / 共23页
毕业设计外文翻译Word文件下载.docx_第11页
第11页 / 共23页
毕业设计外文翻译Word文件下载.docx_第12页
第12页 / 共23页
毕业设计外文翻译Word文件下载.docx_第13页
第13页 / 共23页
毕业设计外文翻译Word文件下载.docx_第14页
第14页 / 共23页
毕业设计外文翻译Word文件下载.docx_第15页
第15页 / 共23页
毕业设计外文翻译Word文件下载.docx_第16页
第16页 / 共23页
毕业设计外文翻译Word文件下载.docx_第17页
第17页 / 共23页
毕业设计外文翻译Word文件下载.docx_第18页
第18页 / 共23页
毕业设计外文翻译Word文件下载.docx_第19页
第19页 / 共23页
毕业设计外文翻译Word文件下载.docx_第20页
第20页 / 共23页
亲,该文档总共23页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

毕业设计外文翻译Word文件下载.docx

《毕业设计外文翻译Word文件下载.docx》由会员分享,可在线阅读,更多相关《毕业设计外文翻译Word文件下载.docx(23页珍藏版)》请在冰点文库上搜索。

毕业设计外文翻译Word文件下载.docx

TheMSP430familyisabroadfamilyoflowpower,featurerich16-bitmicrocontrollersfromTexasInstruments.Theyshareacommon,RISC-type,NeumannCPUcore.The'

430iscompetitiveinpricewiththe8-bitcontrollermarket,andsupportsboth8and16-bitinstructions,allowingmigrationfrommostsimilarlysizedplatforms.

Thefamilyofdevicesrangesfromtheverysmall(1kROM,128bytesforRAM,sub-dollar)uptolarger(60kROM,2kRAM,withpricesinthe$10range)devices.Currently,thereareatleast40flavorsavailable,withmorebeingaddedregularly.Thedevicesaresplitintothreefamilies:

theMSP430x3xx,whichisabasicunit,theMSP430x1xx,whichisamorefeature-richfamily,andtheMSP430x4xx,whichissimilartothe'

1xx,withabuiltinLCDdriver.Youwillfindthesereferredtoas'

1xx,'

3xx,and'

4xxdevicesthroughoutthisbook.

PartNumberingConvention

PartnumbersforMSP430devicesaredeterminedbasedontheircapabilities.Alldevicepartnumbersfollowthefollowingtemplate:

MSP430MtFaFbMc

M:

MemoryType

C:

ROM

F:

Flash

P:

OTP

E:

EPROM(fordevelopmentaluse.Therearefewofthese.)

Fa,Fb:

FamilyandFeatures

10,11:

Basic

12,13:

HardwareUART

14:

HardwareUART,HardwareMultiplier

31,32:

LCDController

33:

LCDController,HardwareUART,HardwareMultiplier

41:

43:

LCDController,HardwareUART

44:

Mc:

MemoryCapacity

0:

1kbROM,128bRAM

1:

2kbROM,128bRAM

2:

4kbROM,256bRAM

3:

8kbROM,256bRAM

4:

12kbROM,512bRAM

5:

16kbROM,512bRAM

6:

24kbROM,1kbRAM

7:

32kbROM,1kbRAM

8:

48kbROM,2kbRAM

9:

60kbROM,2kbRAM

Example:

TheMSP430F435isaFlashmemorydevicewithanLCDcontroller,ahardwareUART,16kbofcodememory,and512bytesofRAM.

Thepartnumberingschemedescribedaboveisabitfragmented.Therearecommonfeaturesnotconsistentlyrepresented(typeofADC,numberoftimers,etc),andtherearesomeotherinconsistencies(forexample,the33familyhasthemultiplier,butthe13and43sdonot).Iwouldrecommendagainstselectingpartsbasedontheirnumberingscheme.Rather,onceyouhaveavagueideaofyourrequirements,gototheTIwebsite(www.TI.com),andusetheirparametricsortfeature.

Architecture:

CPUandMemory

Asdiscussedinchapter1,theMSP430utilizesa16-bitRISCarchitecture,whichiscapableofprocessinginstructionsoneitherbytesorwords.TheCPUisidenticalforallmembersofthe'

430family.Itconsistsofa3-stageinstructionpipeline,instructiondecoding,a16-bitALU,fourdedicated-useregisters,andtwelveworking(orscratchpad)registers.TheCPUisconnectedtoitsmemorythroughtwo16-bitbusses,oneforaddressing,andtheotherfordata.Allmemory,includingRAM,ROM,informationmemory,specialfunctionregisters,andperipheralregistersaremappedintoasingle,contiguousaddressspace.

Thisarchitectureisuniqueforseveralreasons.First,thedesignersatTexasInstrumentshaveleftanawfullotofspaceforfuturedevelopment.AlmosthalftheStatusRegisterremainsavailableforfuturegrowth,roughlyhalfoftheperipheralregisterspaceisunused,andonlysixofthesixteenavailablespecialfunctionregistersareimplemented.

Second,thereareplentyofworkingregisters.Afteryearsofhavingoneortwoworkingregisters,Igreatlyenjoyedmyfirstexperiencewiththetwelve16-bitCPUscratchpads.Theprogrammingstyleisslightlydifferent,andcanbemuchmoreefficient,especiallyinthehandsofaprogrammerwhoknowshowtousethisfeaturetoitsfullest.

Third,thisarchitectureisdeceptivelystraightforward.Itisveryflexible,andtheaddressingmodesaremorecomplicatedthanmostothersmallprocessors.But,beyondthat,thisarchitectureissimple,efficientandclean.Therearetwobusses,asinglelinearmemoryspace,arathervanillaprocessorcore,andallperipheralsarememory-mapped.

CPUFeatures

TheALU

The'

430processorincludesaprettytypicalALU(arithmeticlogicunit).TheALUhandlesaddition,subtraction,comparisonandlogical(AND,OR,XOR)operations.ALUoperationscanaffecttheoverflow,zero,negative,andcarryflags.Thehardwaremultiplier,whichisnotavailableinalldevices,isimplementedasaperipheraldevice,andisnotpartoftheALU(seeChapter6).

WorkingRegisters

430givesthedevelopertwelve16-bitworkingregisters,R4throughR15.(R0throughR3areusedforotherfunctions,asdescribedlater.)Theyareusedforregistermodeoperations(seeAddressingModes,Chapter8),whicharemuchmoreefficientthanoperationswhichrequirememoryaccess.Someguidelinesfortheiruse:

Usetheseregistersasmuchaspossible.Anyvariablewhichisaccessedoftenshouldresideinoneoftheselocations,forthesakeofefficiency.

Generallyspeaking,youmayselectanyoftheseregistersforanypurpose,eitherdataoraddress.However,somedevelopmenttoolswillreserveR4andR5fordebuginformation.Differentcompilerswillusetheseregistersindifferentfashions,aswell.Understandyourtools.

Beconsistentaboutuseoftheworkingregisters.Clearlydocumenttheiruse.Ihavecode,writtenabout8monthsago,thatperformsextensiveoperationsonR8,R9,andR15.Unfortunately,Idon'

tknowtodaywhatthevaluesinR8,R9andR15represent.ThiswascodeIwrotetoquicklyvalidateanalgorithm,ratherthanproductioncode,soIdidn'

tdocumentitsufficiently.Now,itisrelativegibberish.Don'

tletthishappentoyou.Nomatterhowobviousortrivialregisteruseseems,documentitanyway.

ConstantGenerators

R2andR3functionasconstantgenerators,sothatregistermodemaybeusedinsteadofimmediatemodeforsomecommonconstants.(R2isadualuseregister.ItservesastheStatusRegister,aswell.)Generatedconstantsincludesomecommonsingle-bitvalues(0001h,0002h,0004h,and0008h),zero(0000h),andanall1sfield(0FFFFh).GenerationisbasedontheW(S)valueintheinstructionword,andisdescribedbythetablebelow.

W(S)valueinR2valueinR3

00————0000h

01(0)(absolutemode)0001h

100004h0002h

110008h0FFFFh

ProgramCounter

TheProgramCounterislocatedinR0.Sinceindividualmemorylocationaddressesare8-bit,butallinstructionsare16bit,thePCisconstrainedtoevennumbers(i.e.theLSBofthePCisalwayszero).Generallyspeaking,itisbesttoavoiddirectmanipulationofthePC.Oneexceptiontothisruleofthumbistheimplementationofaswitch,wherethecodejumpstoaspot,dependentonagivenvalue.(I.e.,ifvalue=0,jumptolocation0,ifvalue=1,jumptolocation1,etc.)ThisprocessisshowninExample3.1.

Example3.1SwitchStatementviaManualPCControl

Movvalue,R15;

puttheswitchvalueintoR15

CmpR15,#8;

rangechecking

Jgeoutofrange;

ifR15>

7,donotusePCswitch

Cmp#0,R15;

morerangechecking

Jnoutofrange;

RlaR15;

multiplyR15bytwo,sincePCisalwayseven

doubleR15again,sincesymbolicjmpis2wordslong

AddR15,PC;

PCgoestoproperjump

Jmpvalue0

Jmpvalue1

Jmpvalue2

Jmpvalue3

Jmpvalue4

Jmpvalue5

Jmpvalue6

Jmpvalue7

Outofrange

JmpRangeError

Thisisarelativelycommonapproach,andmostCcompilerswillimplementswitchstatementswithsomethingsimilar.Whenimplementingthismanually(i.e.,inassemblylanguage),theprogrammerneedstokeepseveralthingsinmind:

Alwaysdoproperrangechecking.Intheexample,wecheckedforconditionsoutsidebothendsofthevalidrange.Ifthisisnotperformedcorrectly,thecodecanjumptoanunintendedlocation.

Paycloseattentiontotheaddressingmodesofthejumpstatements.TheseconddoublingofR15,priortotheaddstatement,isaddedbecausethejumpstatementrequirestwowordswhensymbolicmodeaddressingisused.

Becarefulthatnoneofyourinterrupthandlershavethepotentialtoaffectyourvalueregister(R15intheexample).Iftheinterrupthandlerneedstouseoneoftheseregisters,thehandlerneedstostorethevaluetoRAMfirst.ThemostcommonprocedureistopushtheregistertothestackatthebeginningoftheISR,andtopoptheregisterattheendoftheISR.(SeeExample3.2.)

Example3.2Push/PopCombinationinISR

Timer_A_Hi_Interrupt

PushR12;

WewilluseR12

MovP1IN,R12;

useR12asweplease

RlaR12

RlaR12

MovR12&

BAR;

DonewithR12

PopR12;

RestorepreviousvaluetoR12

Reti;

returnfrominterrupt

ORG0FFF0h

DWTimer_A_Hi_Interrupt

StatusRegister

TheStatusRegisterisimplementedinR2,andiscomprisedofvarioussystemflags.Theflagsarealldirectlyaccessiblebycode,an

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 人文社科 > 法律资料

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2