资源预览内容
第1页 / 共57页
第2页 / 共57页
第3页 / 共57页
第4页 / 共57页
第5页 / 共57页
第6页 / 共57页
第7页 / 共57页
第8页 / 共57页
第9页 / 共57页
第10页 / 共57页
亲,该文档总共57页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
1 Chapter3 Instructionsystem MicrocontrollerPrincipleandApplication 主讲教师 黄英 2 Contents 3 1InstructionformatandAddressingModes 3 2InstructionIntroduction Chapter3Instructionsystem 3 AssembleLanguage symboliclanguage Assembler Acomputerprogramusedtoassemble SourceProgram Assembler Objectprogram Sourcecodes Machinecodes InstructionSet cannottransplantdirectly Chapter3Instructionsystem 3 1InstructionformatandAddressingModes 4 3 1InstructionformatandAddressingModes 3 1 1Instructionformat Instruction opcodeoperand opcodedestinationoperand sourceoperand Instructiontypes 1 byteInstruction includesopcodeandoperand2 byteInstruction 1thbyteisopcode2thbyteisoperand3 byteInstruction 1thbyteisopcode2th 3thbyteareoperands 5 3 1InstructionformatandAddressingModes Addressing howtogetthelocationof source operand AddressingModes 7types1 RegisterAddressing2 DirectAddressing3 RegisterIndirectAddressing4 ImmediateConstantsAddressing5 IndexedAddressing6 BooleanAddressing 3 1 2AddressingModes 7 RelativeAddressing getthejumpingdestinationaddressofPC 6 3 1 2AddressingModes 1 RegisterAddressing Operand denotedbyregister Forexample MOVA R0 AddressingRange Generalregister 4banks 8 R0 R7 32registers SomeSFRs A AB DPTR etc 7 3 1 2AddressingModes Operand denoteddirectlyby8 bitaddress Forexample MOVA 3AH AddressingRange Lower128bytesofinternalRAM SFRs 2 DirectAddressing 8 3 1 2AddressingModes Operand specifiesaregistertocontainoperandaddresswiththeprefix AddressingRange Lower128bytesofinternalRAM 8 bitaddress 64KBofexternalRAM 16 bitaddress 3 RegisterIndirectAddressing addressregisterof8 bitaddress Ri i 0 1 SP PUSH POP addressregisterof16 bitaddress DPTR Forexample MOVA R0MOVXA DPTR 9 3 1 2AddressingModes Operand specifiesthevalueofa8 bitor16 bitconstantwiththeprefix Forexample MOVA 3AHMOVDPTR 0200H 4 ImmediateConstantsAddressing 10 3 1 2AddressingModes Onlythreeinstruction MOVCA A DPTRMOVCA A PCJMP A DPTR AddressingRange ProgramMemory ROM 5 IndexedAddressing ProgramMemorycanonlybeaccessedviathismode Designedforreadinglook uptablesinProgramMemoryorexecutingunconditionaljumps A16 bitbaseregister DPTRorPC pointstothebaseaddressoftable andAissetupwiththetableentrynumber The16 bitaddressinROMisformedbyaddingtheAdatatothebasepointer 11 3 1 2AddressingModes AddressingRange 1 BitaddressableareainInternalRAMcelladdress 20H 2FH bitaddress 00H 7FH 2waystospecifiestheaddressingbit Celladdress bit 20H 6 Bitaddress 06H 6 BooleanAddressing 2 AddressablebitinSFRs 4waystospecifiestheaddressingbit SFRsymbol bit PSW 5 Bitaddress 0D5H Celladdress bit 0D0H 5 Bitname F0 12 3 1 2AddressingModes offsetRange 128 backward 127 forward 7 RelativeAddressing UsedforgettingthejumpingdestinationaddressofPCinJumpInstruction Destinationaddress PC relPC address bytenumber ofJumpinstructionrel 8 bitrelativeoffsetbyte Return 13 Chapter3Instructionsystem 3 2InstructionIntroduction 111items Datatransferinstructions 29items Arithmeticinstructions 24items Logicalinstructions 24items Jumpinstructions 17items Booleaninstructions 17items PortAccessinstructions ThesymbolmeaningofInstructionformat Return 14 3 2InstructionIntroduction 3 2 1ThesymbolmeaningofInstructionformat Return SeeP45 15 3 2InstructionIntroduction Generalformat MOV Sourceoperand A Rn Directaddress Indirectaddressregister data data16Destinationoperand A Rn Directaddress Indirectaddressregister 3 2 2Datatransferinstructions 29items 16 8 bitdata MOVA dataMOVA 00HMOVdirect dataMOV3CH 0FFHMOVRn dataMOVR5 0FHMOV Ri dataMOV R1 0CH 16 bitdata MOVDPTR data16MOVDPTR 0200H 3 2 2Datatransferinstructions DataTransferofinternalRAM 1 TransferimmediateConstants 17 MOVdirect2 direct1MOV50H 30HMOVdirect RnMOV32H R1MOVRn directMOVR0 33HMOV Ri directMOV R1 0D0HMOVdirect RiMOV0D0H R1 3 2 2Datatransferinstructions 2 TransferdataamonginternalRAMcells 18 MOVA RnMOVA R3MOVRn AMOVR2 AMOVA directMOVA 0E0HMOVdirect AMOV30H AMOVA RiMOVA R0MOV Ri AMOV R1 A 3 2 2Datatransferinstructions 3 TransferdatabyA 19 1 TransferdatabyDPTRMOVXA DPTRMOVX DPTR A 2 TransferdatabyRiMOVXA RiMOVX Ri ATheyareRead WriteinstructionsofexternalRAM 3 2 2Datatransferinstructions 2 DataTransferofexternalRAM 20 MOVCA A DPTRMOVCA A PC Readinstructionsofprogrammemory Indexedaddressingmode Designedforreadinglook uptablesinProgramMemory 3 2 2Datatransferinstructions Forexample PCA2000HBA INCA 200101H2001MOVCA A PC 200230H2002RET 20032003DB30H2004DB31H2005DB32H 3 DataTransferofProgramMemory 21 XCHA RnXCHA directXCHA RiXCHDA Ri A3 A0 Ri3 Ri0 SWAPA A3 A0 A7 A4 3 2 2Datatransferinstructions 4 DataExchangeInstruction Forexample MOVR0 20H R0 20HMOVA 3FH A 3FHMOV20H 75H 20H 75HXCHDA R0 A 35H 20H 7FHSWAPA A 53H 22 PUSHdirect SP SP 1 SP direct POPdirect direct SP SP SP 1 3 2 2Datatransferinstructions 5 StackoperationInstruction Return 23 3 2InstructionIntroduction Forunsignedconstants Includingthefollowing7types 3 2 3ArithmeticInstructions 24items 1 AdditionInstructions2 AdditionInstructionswithcarrybit3 SubtractionInstructionswithcarrybit4 IncrementInstructions5 DecrementInstruction
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号