《单片机原理与接口技术 (19).pdf》由会员分享,可在线阅读,更多相关《单片机原理与接口技术 (19).pdf(43页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、单片机原理与接口技术MCS-51ROM 6RAM SFRMCS-514KB80310000H 0FFFH64KB0000H 0FFFFH128B00H 7FH80H 0FFH64KB0000H 0FFFFH位80000H0001H0002HFFFFHDBCBA1ABA0012367010 0 001 11111111111111111111111110 0 0 00 0 0 00 0 0 00 0 0 00 0 00 00 00 00000000450000010000001110123012367010 0 001 11111111111111111111111110 0 0 00 0 0
2、00 0 0 00 0 0 00 0 00 00 00 00000000450000011001100011231ALECPUMOV A#09H 74H 09H09HAAABDBCBAT89S51/PC=0000H0001H0000H0002H0 1 1 1 0 1 0 00 0 0 0 1 0 0 1(PC)(PC)0001H0002H0000HCB(PC)ALUCPU/ALUCPU51VonNeumannAT89C51HarvardMCS-5112345678910111213142827262524232221 201918171615EPROM276412345678910111213
3、142827262524232221 201918171615EPROM27641234567891011121314151617181920403938373635343332313029282726252424222112345678910111213142827262524232221 201918171615RAM6264 12345678910111213142827262524232221 201918171615RAM6264 80318751805189C51RAMROM256B4K64K64KMCS-51:4KB80310000H 0FFFH64KB0000H 0FFFFH1
4、28B00H 7FH80H0FFH64KB0000H 0FFFFHROM4KBEA=1ROM4KBEA=00FFFH0000H0FFFH0000HFFFFH1000HROM60KBMOVC RAM128BRAM64KB(26SFR)FFH80H7FH00HFFFFH0000HMOV MOVX MCS-51RAM(128)00H-7FH20H-2FH318H-1FH210H-17H108H-0FH000H-07HRAM30H-7FH16128CPUPSWRS0RS1MCS-51RAM(128)32107FH30H2FH20H1FH18H17H10H0FHR0-R71620H-2FH128 00H
5、-7FHRAM30H-7FHRAM128B08H07H00H1288-bit20H7FH96+00H1FHR0R7AT89S510000HFFFFH64K bytesMCS-51RAM00H 1FH32488R0R7CPUPSWRS0RS1PSW.4(RS1)PSW.3(RS0)000 00H 07H011 08H 0FH102 10H 17H113 18H 1FHRAM00H-1FH01238R0R7PSWRS1RS0RAMCPUMCS-51MCS-51012300HR008HR010HR018HR001HR109HR111HR119HR102HR20AHR212HR21AHR203HR30
6、BHR313HR31BHR304HR40CHR414HR41CHR405HR50DHR515HR51DHR506HR60EHR616HR61EHR607HR70FHR717HR71FHR7R0R7R0R700H07H0MOVR0,#24H”24HR000HMOVR5,#3FH”R505H3FHPSW.4 RS1PSW.3 RS0000 00H 07H011 08H 0FH102 10H 17H113 18H 1FHMCS-51MCS-518“161“SFRRAM20H2FH1612800H7FH07FHRAM2FH.7MCS-51D7D6D5D4D3D2D1D02FH7FH7EH7DH7CH7
7、BH7AH79H78H2EH77H76H75H74H73H72H71H70H2DH6FH6EH6DH6CH6BH6AH69H68H2CH67H66H65H04H63H62H61H60H2BH5FH5EH5DH5CH5BH5AH59H58H2AH57H56H55H54H53H52H51H50H29F4FH4EH4DH4CH4BH4AH49H48H28H47H46H45H44H43H42H41H40H27H3FH3EH3DH3CH3BH3AH39H38H26H37H36H35H34H33H32H31H30H25H2FH2EH2DH2CH2BH2AH29H28H24H27H26H25H24H23H2
8、2H21H20H23H1FH1EH1DH1CH1BH1AH19H18H22H17H16H15H14H13H12H11H10H21H0FH0EH0DH0CH0BH0AH09H08H20H07H06H05H04H03H02H01H00H20H2FH1616168=128SETB1CLR0(1)SETB 00H(2)SETB 20H.0MCS-51RAM20H2FH20H2FH16MOV 20HAARAM20H20H2FH16*8128bit00H7FHCPUbitMOV 20HCCy20HMCS-51RAMRAM30H7FHRAM8052RAM30HFFH208RAM00H20H2FH7FH1FH
9、30H80HFFH52子系列才有的RAM区用户RAM区位寻址区工作寄存器区80MCS-51SFRSFRCPURAM80H0FFH21SFR80H0FFH21SFR2111AE0E0H-E7H8SFRSFR.PSWD3D3HRS0PSW.3.MCS-51SFRSFRD7 /D0BBF7F6F5F4F3F2F1F0F0HAACCE7E6E5E4E3E2E1E0E0HPSWD7D6D5D4D3D2D1D0D0HCYACF0RS1RS0OVPIPBFBEBDBCBBBAB9B8B8HPSPT1PX1PT0PX0I/O3P3B7B6B5B4B3B2B1B0B0HP3.7P3.6P3.5P3.4P3.3P
10、3.2P3.1P3.0IEAFAEADACABAAA9A8A8HEAESET1EX1ET0EX0I/O2P2A7A6A5A4A3A2A1A0A0HP2.7P2.6P2.5P2.4P2.3P2.2P2.1P2.0SBUF99HSCON9F9E9D9C9B9A999898HSM0SM1SM2RENTB8RB8TIRII/O1P1A99695949392919090HP1.7P1.6P1.5P1.4P1.3P1.2P1.1P1.0SFRSpecialFunction Register256B128BSFRRAMRAMMCS-51SFRSFRD7 /D0/1TH18DH/0TH08CH/1TL18BH
11、/0TL08AH/TMODGATEC/TM1M0GATEC/TM1M089H/TCON8F8E8D8C8B8A898888HTF1TR1TF0TR0IE1IT1IE0IT0PCONSMODGF1GF0PDIDL87HDPH83HDPL82HSP81HI/O0P0878685848382818080HP0.7P0.6P0.5P0.4P0.3P0.2P0.1P0.0AT89S512680H0FFHAPSWP0P3MCS-51ROM0000H0FFFH(4K)0000HFFFFH(64K)0000H0FFFH(4K)0000H0001H0002H(PC)0000H,543210003H000BH00
12、13H001BH0023H002BH001180FFFH0FFEHEA=1 EA=0MCS-51ROMROMROMMOVC89C514KBROM1664KBROMROMROMEAPC0000H0FFFH4KBROM4KBCPUROMEAROMROM0000H8031ROMROM0000HEAMCS-510000H0003H000BH0013H001BH0023HLJMP0100H0100HROM0000H0100HMCS-51ROM0000H(上电启动地址)(INT0中断入口)(T0中断入口)(INT1中断入口)(T1中断入口)(串口中断入口)ROM0000HPC0003H/INT0000BH
13、T00013H/INT1001BHT10023HMCS-51SFRPC(Program Counter)PC16ROM161CPUPCCPUPC=0000HROM0000H-0002HLJMPADDR16ADDR16PCPCPC1PCPC(Program Counter)PCPC=0000H0000H0000HPC10001H0001HAT89C514KB41024=4096 bytes4096 bytes0000H0FFFH0000H0000H74H0111 0100”0001H89H1000 1001”SFRPC(Program Counter)PC16PCAT89C510000HFFFF
14、H64KBAT89C514KB0000H0FFFH64KB-4KB=60KB1000HFFFFHFFFFH60KB1000H0FFFH4KB0000HSFR?PC=0000H0000H0FFFHEA/VPPPC0FFFHPC11000H0000HPC0000HFFFFHEA/VPPSFRA(Accumulator)ACC8CPUALUE0ACCA3+53A30H=05HA8MOV A#03HA3ADD A30HAA+5SFRPSWPSW8PSW:PSW.7PSW.6PSW.5PSW.4PSW.3PSW.2PSW.1PSW.0CyACF0RS1RS0OVPCyPSW.7ACPSW.6F0PSW.
15、50”RS1RS0 PSW.4PSW.3OVPSW.2PSW.1PPSW.0A101SFRPSWCyPSW.7RS1RS0=00HF0=0MOV A#0AHADD A#0F7HPSW?0 0 0 0 1 0 1 0 B+1 1 1 1 0 1 1 1 B1 0 0 0 0 0 0 0 1 BCy=1CyPSW4Cy1Cy0Cy1Cy0/CYSFRPSWAC PSW.6RS1RS0=00HF0=0MOV A#0AHADD A#0F7HPSW?0 0 0 0 1 0 1 0 B+1 1 1 1 0 1 1 1 B1 0 0 0 0 0 0 0 1 BAC=1F0=0/44/ACAC0ACF0 PS
16、W.5SFRPSWRS1RS0PSW.4 PSW.3 RS1RS0=00HF0=0MOV A#0AHADD A#0F7HPSW?0 0 0 0 1 0 1 0 B+1 1 1 1 0 1 1 1 B1 0 0 0 0 0 0 0 1 BP=1RS1=0、RS0=0RS1 RS0R0R70 00 00H 07H0 11 08H 0FH1 02 10H 17H1 13 18H 1FHP PSW.0A11P=01P=1SFRPSWOVPSW.2RS1RS0=00HF0=0MOV A#0AHADD A#0F7HPSW?0 0 0 0 1 0 1 0 B+1 1 1 1 0 1 1 1 B1 0 0 0
17、 0 0 0 0 1 BOV=CyCS1l0/OV=1A-128 +127OV=0OV=CyCS(CSOV=1255OV=10/SFROVCy0000010100001010 00001111Cy0OV0(a)0000100011111011 000000111Cy1OV0(b)0000100001111100 10000100Cy0OV1(c)1000011111110101 011111001Cy1OV1(d)Cy1OV1OV0110101101011100 11000111=71 OV110792199SFRSP(Stack Pointor)PUSHPOPLIFOLast-In-Firs
18、t-Out栈顶栈底(可用软件设置)35H34H33H32H31H30H堆栈指针(SP)MOV SP,#30H PUSH ACC PUSH PSW.POP PSW POP ACC SFRSP(Stack Pointor)SP8RAM 12800H7FHSPSPSP07HRAM30H7FHSP30HSP=07H00H7FHRAMSP=60H00H7FHMOV SP,#60HSFRPCPCPUSHPOPSFRDPTR(Data Pointer)8051DPTR28DPHDPLROM/RAM16I/OMCS-51168DPH8DPL8SFRP2.5P2.4:P2.0P0.7:P0.0ALE/RD/WR
19、CEA12:A8A7 O7:A0 O0/OE/WED7 Q7D0 Q0CP62648K RAMMCS-51/CE=P2.5(A12)/OEDPTRRAMCPURAMMOV DPTR#2000HMOVXA,DPTRP0P2DPTR1616DPTR64KBP0RAM2000HSFRP2.5P2.4:P2.0P0.7:P0.0ALE/RD/WRCEA12:A8A7 O7:A0 O0/OE/WED7 Q7D0 Q0CP62648K RAMMCS-51/CE=P2.5(A12)/OERAM0020HxAMOV DPTR#0020H MOVX A DPTR MCS-51DPTR-RAM64KB;R0R1-256BMOV R0#20H MOVX A R0 SFR/CEA15A14:A8A7 O7:A0 O0OE64K ROMMCS-51/OED7 Q774LS373D0 Q0G /LP2.7:P2.0P0.7:P0.0ALE/EAPSENDPTR8DPHDPL16DPTRCPUDPTRROMMOV DPTR#DATA16MOVC A A+DPTRSFRB(General Purpose Register)8B8BBB0F0HMOV A,#25H;A=25HMOV B,#0C7H;B=0C7HMUL AB;B=1CH8A=C3H8SFR启迪智慧思维创造精彩人生