黄英_《单片机原理及应用》讲义.ppt

上传人:bao****ty 文档编号:135662334 上传时间:2020-06-17 格式:PPT 页数:57 大小:643.50KB
返回 下载 相关 举报
黄英_《单片机原理及应用》讲义.ppt_第1页
第1页 / 共57页
黄英_《单片机原理及应用》讲义.ppt_第2页
第2页 / 共57页
黄英_《单片机原理及应用》讲义.ppt_第3页
第3页 / 共57页
黄英_《单片机原理及应用》讲义.ppt_第4页
第4页 / 共57页
黄英_《单片机原理及应用》讲义.ppt_第5页
第5页 / 共57页
点击查看更多>>
资源描述

《黄英_《单片机原理及应用》讲义.ppt》由会员分享,可在线阅读,更多相关《黄英_《单片机原理及应用》讲义.ppt(57页珍藏版)》请在金锄头文库上搜索。

1、1 Chapter3 Instructionsystem MicrocontrollerPrincipleandApplication 主讲教师 黄英 2 Contents 3 1InstructionformatandAddressingModes 3 2InstructionIntroduction Chapter3Instructionsystem 3 AssembleLanguage symboliclanguage Assembler Acomputerprogramusedtoassemble SourceProgram Assembler Objectprogram Source

2、codes Machinecodes InstructionSet cannottransplantdirectly Chapter3Instructionsystem 3 1InstructionformatandAddressingModes 4 3 1InstructionformatandAddressingModes 3 1 1Instructionformat Instruction opcodeoperand opcodedestinationoperand sourceoperand Instructiontypes 1 byteInstruction includesopco

3、deandoperand2 byteInstruction 1thbyteisopcode2thbyteisoperand3 byteInstruction 1thbyteisopcode2th 3thbyteareoperands 5 3 1InstructionformatandAddressingModes Addressing howtogetthelocationof source operand AddressingModes 7types1 RegisterAddressing2 DirectAddressing3 RegisterIndirectAddressing4 Imme

4、diateConstantsAddressing5 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

5、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 bitaddres

6、s 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

7、ImmediateConstantsAddressing 10 3 1 2AddressingModes Onlythreeinstruction MOVCA A DPTRMOVCA A PCJMP A DPTR AddressingRange ProgramMemory ROM 5 IndexedAddressing ProgramMemorycanonlybeaccessedviathismode Designedforreadinglook uptablesinProgramMemoryorexecutingunconditionaljumps A16 bitbaseregister D

8、PTRorPC pointstothebaseaddressoftable andAissetupwiththetableentrynumber The16 bitaddressinROMisformedbyaddingtheAdatatothebasepointer 11 3 1 2AddressingModes AddressingRange 1 BitaddressableareainInternalRAMcelladdress 20H 2FH bitaddress 00H 7FH 2waystospecifiestheaddressingbit Celladdress bit 20H

9、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 UsedforgettingthejumpingdestinationaddressofPCinJumpIns

10、truction Destinationaddress PC relPC address bytenumber ofJumpinstructionrel 8 bitrelativeoffsetbyte Return 13 Chapter3Instructionsystem 3 2InstructionIntroduction 111items Datatransferinstructions 29items Arithmeticinstructions 24items Logicalinstructions 24items Jumpinstructions 17items Booleanins

11、tructions 17items PortAccessinstructions ThesymbolmeaningofInstructionformat Return 14 3 2InstructionIntroduction 3 2 1ThesymbolmeaningofInstructionformat Return SeeP45 15 3 2InstructionIntroduction Generalformat MOV Sourceoperand A Rn Directaddress Indirectaddressregister data data16Destinationoper

12、and 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 TransferimmediateConst

13、ants 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 2Dat

14、atransferinstructions 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

15、 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 2Datatransferinstructio

16、ns 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

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 高等教育 > 其它相关文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号