´ð£º¶ÑÕ»ÔÚÖж˹ý³ÌÖÐÓÃÀ´±£»¤ÏÖ³¡Êý¾Ý£¬¸´Î»ºóSP=7H£¬¶ø¶ÑÕ»Ò»°ãÉèÖÃÔÚͨÓÃROMÇø£¨30H-7FH£©£¬ÔÚϵͳ³õʼ»¯Ê±ºòÒª´ÓÐÂÉèÖá£
10¡¢ÄÚ²¿ RAMµÍ 128µ¥Ôª»®·ÖΪÄÄ 3¸öÖ÷Òª²¿·Ö£¿ËµÃ÷¸÷²¿·ÖµÄʹÓÃÌص㡣
´ð£º80C51ÄÚ²¿128BµÄÊý¾ÝRAMÇø£¬°üÀ¨Óй¤×÷¼Ä´æÆ÷×éÇø¡¢¿ÉÖ±½ÓλѰַÇøºÍÊý¾Ý»º³åÇø¡£¸÷ÇøÓòµÄÌØÐÔÈçÏ£º
£¨1£© 00H~1FHΪ¹¤×÷¼Ä´æÆ÷×éÇø£¬¹²·Ö4×飬ÿ×éÕ¼ÓÃ8¸öRAM×Ö½Úµ¥Ôª£¬Ã¿¸öµ¥Ôª
×÷Ϊһ¸ö¹¤×÷¼Ä´æÆ÷£¬Ã¿×éµÄ8¸öµ¥Ôª·Ö±ð¶¨ÒåΪ8¸ö¹¤×÷¼Ä´æÆ÷R0~R7¡£µ±Ç°¹¤×÷¼Ä´æÆ÷×éµÄÑ¡ÔñÊÇÓɳÌÐò״̬×ÖPSWµÄRS1¡¢RS0Á½Î»À´È·¶¨¡£Èç¹ûʵ¼ÊÓ¦ÓÃÖв¢²»ÐèҪʹÓù¤×÷¼Ä´æÆ÷»ò²»ÐèҪʹÓÃ4×鹤×÷¼Ä´æÆ÷£¬²»Ê¹ÓõŤ×÷¼Ä´æÆ÷×éµÄÇøÓòÈÔÈ»¿É×÷Ϊһ°ãÊý¾Ý»º³åÇøʹÓã¬ÓÃÖ±½ÓÑ°Ö·»òÓÃRiµÄ¼Ä´æÆ÷¼ä½ÓÑ°Ö·À´·ÃÎÊ¡£
£¨2£© 20H~2FHΪ¿ÉλѰַÇøÓò£¬Õâ16¸ö×Ö½ÚµÄÿһλ¶¼ÓÐÒ»¸öµØÖ·£¬±àַΪ00H~7FH¡£
µ±È»£¬Î»Ñ°Ö·ÇøÒ²¿ÉÒÔÓÃ×÷×Ö½ÚÑ°Ö·µÄÒ»°ãÊý¾Ý»º³åÇøʹÓá£
£¨3£©30H~7FHΪ¶ÑÕ»¡¢Êý¾Ý»º³åÇø¡£ 11¡¢¼òÊöMCS-51µ¥Æ¬»ú´æ´¢ÇøµÄ»®·Ö¡£
´ð£ºMCS-51µ¥Æ¬»úµÄ´æ´¢Æ÷´ÓÎïÀí½á¹¹ÉÏ·ÖΪ£ºÆ¬ÄÚºÍƬÍâÊý¾Ý´æ´¢Æ÷£¬Æ¬ÄÚºÍƬÍâ³ÌÐò´æ´¢Æ÷¡£
2£©´ÓÂß¼ÉÏ·Ö±ð¿É»®·ÖΪ£ºÆ¬ÄÚͳһѰַµÄ64K³ÌÐò´æ´¢Æ÷¿Õ¼ä£¨0000H---FFFFH£©£»64KBµÄƬÍâÊý¾Ý´æ´¢Æ÷¿Õ¼ä£¨0000H---FFFFH£©;256BµÄƬÄÚÊý¾Ý´æ´¢Æ÷¿Õ¼ä£¨00H---FFH£©¡£ 12¡¢MCS-51»ù±¾Ð͵¥Æ¬»úµÄÖжÏÈë¿ÚµØÖ·¸÷Ϊ¶àÉÙ¡£ ´ð£ºÍⲿÖжÏ0 ÖжÏÈë¿ÚµØÖ· 0003H ¶¨Ê±/¼ÆÊýÆ÷0 ÖжÏÈë¿ÚµØÖ· 000BH ÍⲿÖжÏ1 ÖжÏÈë¿ÚµØÖ· 0013H ¶¨Ê±/¼ÆÊýÆ÷1 ÖжÏÈë¿ÚµØÖ· 001BH ´®ÐÐ½Ó¿Ú ÖжÏÈë¿ÚµØÖ· 0023H
13¡¢Ê²Ã´ÊÇÖ¸ÁîÖÜÆÚ¡¢»úÆ÷ÖÜÆÚºÍʱÖÓÖÜÆÚ£¿
´ð£ºÖ¸ÁîÖÜÆÚ£ºÖ¸ÁîµÄÖ´ÐÐʱ¼ä£»»úÆ÷ÖÜÆÚ£ºCPUÍê³ÉÒ»¸ö×î¼òµ¥µÄÖ¸ÁîËùÐèÒªµÄʱ¼ä£»Ê±ÖÓÖÜÆÚ£º¾§ÕñÐźÅÖÜÆÚ¾ÍÊÇʱÖÓÖÜÆÚ¡£
14¡¢ÒÑÖªÒ»MCS51µ¥Æ¬»úϵͳʹÓÃ6MHZµÄÍⲿ¾§ÌåÕñµ´Æ÷£¬¼ÆË㣺¸Ãµ¥Æ¬»úϵͳµÄ״̬ÖÜÆÚÓë»úÆ÷ÖÜÆÚ¸÷Ϊ¶àÉÙ£¿
½â£ºÓÉÓÚ¾§ÕñΪ6MHz£¬ËùÒÔ»úÆ÷ÖÜÆÚΪ2us£¬ÒòΪһ¸ö»úÆ÷ÖÜÆÚÓÉ6¸ö״̬ÖÜÆÚ×é³É£¬ËùÒÔ״̬ÖÜÆÚ1/3us
15¡¢8031µ¥Æ¬»úÐèÒªÍâ½Ó³ÌÐò´æ´¢Æ÷£¬Êµ¼ÊÉÏËü»¹ÓжàÉÙÌõI/OÏß¿ÉÒÔÓ㿵±Ê¹ÓÃÍⲿ´æ´¢Æ÷ʱ£¬»¹Ê£Ï¶àÉÙÌõI/OÏß¿ÉÓã¿
´ð£º8031ϵͳ±ØÐëÍâ½Ó³ÌÐò´Ù³ÉÆ÷£¬ÔÔòÉÏ˵£¬P0ºÍP2¿ÚÒªÓÃ×÷Êý¾ÝºÍµØÖ·×ÜÏߣ¬ËùÒÔÖ»ÓÐP1ºÍP3¿Ú¿ÉÓÃ×÷I/O¿Ú£¬¹²16ÌõI/OÏß¡£ÔÚʹÓÃÍⲿ´æ´¢Æ÷ʱ£¬³ýÁËÕ¼ÓÃP0ºÍP2¿ÚÍ⣬»¹ÐèÒªÓÃP3¿ÚRD£¨P3.7£©ºÍWR£¨P3.6£©Á½Ìõ¿ØÖÆÏߣ¬ËùÒÔÕâÖÖÇé¿öϾÍֻʣÏÂ14ÌõI/OÏß¿ÉÓÃÁË¡£
µÚ4Õ ˼¿¼Ìâ¼°Ï°Ìâ²Î¿¼´ð°¸ 1. Ñ°Ö··½Ê½ÊÇʲô£¿
´ð£ºÑ°Ö··½Ê½ÊÇÑ°ÕÒ²Ù×÷Êý»ò²Ù×÷ÊýµØÖ·µÄ·½Ê½¡£
µÚ 9 Ò³ ¹² 47 Ò³
2. 89C51Ö¸ÁîϵͳÓÐÄļ¸ÖÖÑ°Ö··½Ê½£¿
´ð£º89C51µÄÑ°Ö··½Ê½ÓÐÆßÖÖ¡£¼´£º¼Ä´æÆ÷Ñ°Ö·¡¢Ö±½ÓÑ°Ö·¡¢¼Ä´æÆ÷¼ä½ÓÑ°Ö·¡¢Á¢¼´Ñ°Ö·¡¢»ùÖ·¼Ä´æÆ÷¼Ó±äÖ·¼Ä´æÆ÷±äÖ·Ñ°Ö·¡¢Ïà¶ÔÑ°Ö·ºÍλѰַ¡£
3¡¢·ÃÎÊÌØÊ⹦ÄܼĴæÆ÷SFR¿ÉÒÔ²ÉÓÃÄÄЩѰַ·½Ê½£¿
´ð£ºÖ±½ÓÑ°Ö·ºÍλѰַ·½Ê½¡£
4¡¢·ÃÎÊRAMµ¥Ôª¿ÉÒÔ²ÉÓÃÄÄЩѰַ·½Ê½£¿·ÃÎÊÍⲿRAMµ¥ÔªÓÐÄÄЩָÁ
´ð£ºÖ±½ÓÑ°Ö·¡¢¼Ä´æÆ÷¼ä½ÓÑ°Ö·ºÍλѰַ·½Ê½¡£
·ÃÎÊÍⲿRAMµ¥ÔªµÄÖ¸ÁîÓÐ4Ìõ£º MOVX A£¬@DPTR MOVX A£¬@Ri MOVX @DPTR£¬A
MOVX @Ri£¬A
5¡¢·ÃÎÊÍⲿ³ÌÐò´æ´¢Æ÷¿ÉÒÔ²ÉÓÃÄÄЩѰַ·½Ê½£¿·ÃÎÊÍⲿ³ÌÐò´æ´¢Æ÷ÓÐÄÄЩָÁ
´ð£ºÁ¢¼´Ñ°Ö·¡¢±äÖ·Ñ°Ö·ºÍÏà¶ÔÑ°Ö··½Ê½¡£
·ÃÎÊÍⲿ³ÌÐò´æ´¢Æ÷µÄÖ¸ÁîÓÐ2Ìõ MOVC A£¬@A+DPTR MOVC A£¬@A+PC
6¡¢ÊÔд³öÍê³ÉÒÔÏÂÿÖÖ²Ù×÷µÄÖ¸ÁîÐòÁС£ £¨1£©½«R0µÄÄÚÈÝ´«Ë͵½Æ¬ÄÚRAM 20H£» £¨2£©½«R1µÄÄÚÈÝ´«Ë͵½R0£»
£¨3£©ÄÚ²¿RAMµ¥Ôª10HµÄÄÚÈÝ´«Ë͵½ÍⲿRAMµ¥Ôª1000H£» £¨4£©ÍⲿRAMµ¥Ôª1000HµÄÄÚÈÝ´«Ë͵½R5£» £¨5£©ÍⲿROMµ¥Ôª1000HµÄÄÚÈÝ´«Ë͵½R5£»
£¨6£©ÍⲿRAMµ¥Ôª2000HµÄÄÚÈÝ´«Ë͵½ÍⲿRAMµ¥Ôª2001H¡£ ´ð£º£¨1£©MOV 20H,R0
(2) MOV A,R1 MOV R0,A (3)MOV A,10H MOV DPTR,#1000H MOVX @DPTR,A
(4)MOV DPTR,#1000H MOVX A,@A+DPTR MOV R5,A
(5) MOV DPTR,#1000H MOV A,#00H MOVC A,@A+DPTR MOV R5,A
(6) MOV DPTR,#2000H MOVX A,@DPTR
µÚ 10 Ò³ ¹² 47 Ò³
INC DPTR MOVX @DPTR,A
7. ÉèÄÚ²¿RAM (30H)=60H, (60H)=10H, (10H)=20H, (R1)=22H,(P1)=0AH, ·ÖÎöÒÔϳÌÐòÖ´Ðкó(30H)=£¿, (60H)= £¿, (10H)= £¿,£¨A£©= £¿,£¨B£©= £¿,£¨P2£©= £¿Ã¿ÌõÖ¸ÁîµÄ»úÆ÷ÂëΪ¶àÉÙ£¿
MOV R0, ££30H MOV A, @R0 MOV R1, A MOV B, @R1 MOV @R1, P1 MOV P2, P1 MOV 10H, ££90H
´ð£º MOV R0, ££30H ; (R0)= 30H , 78 30 MOV A, @R0 ; (A) =60H , E6 MOV R1, A ; (R1) =60H , F9 MOV B, @R1 ; (B) = 10H , 87 F0 MOV @R1, P1 ; (60H) =0AH , A7 90
MOV P2, P1 ; (P2) =0AH , 85 90 A0 MOV 10H, ££90H ; (10H) =90H , 75 10 90
(30H)= 60H, (60H)= 0A H, (10H)= 90H,£¨A£©= 60H,£¨B£©= 10H,£¨P2£©= 0AH
8. ÉèÍⲿRAM (2030H)=0FH, ·ÖÎöÒÔÏÂÖ¸ÁîÖ´Ðкó(DPTR)=?, (30H)=?, (2030H)=?(A)=?ÿÌõÖ¸ÁîµÄ»úÆ÷ÂëΪ¶àÉÙ£¿
MOV DPTR, ££2030H MOVX A, @DPTR MOV 30H, A MOV A, ££3FH MOVX@DPTR, A ª¤ ´ð£º
MOV DPTR, ££2030H ; (DPTR) = 2030H , 90 20 30
MOVX A, @DPTR ; (A) =0FH , E0
MOV 30H, A ; (30H) =0FH , F5 30 MOV A, ££3FH ; (A) =3FH , 74 3F MOVX@DPTR, A ; (2030H)=3FH , F0ª¤
Ö´Ðнá¹ûΪ: (DPTR)=2030H, (30H)=0FH, (2030H)=3FH ,(A)=3FH¡£
9¡¢±àдָÁîʵÏÖÏÂÁÐλ²Ù×÷¡£ £¨1£©Ê¹ÀÛ¼ÓÆ÷µÄ×î¸ß2λÇåÁ㣻 £¨2£©ÆÁ±Î£¨ÇåÁ㣩20HµÄ¸ß4λ£»
£¨3£©½«E0HµÄµÍ4λȡ·´£¬¸ß4λ²»±ä£»
µÚ 11 Ò³ ¹² 47 Ò³
£¨4£©½«P0µÄµÍ2λÖÃ1¡£
£¨5£©½«10HµÄÄÚÈÝÈ¡²¹ºó´æ·Åµ½20H ´ð£º£¨1£©CLR ACC.7 CLR ACC.6
(2) ANL 20H,#0FH (3) XRL E0H,#0FH (4)ORL P0,#03H (5) XRL 10H,#0FFH INC 10H MOV 20H,10H
10. ÔÚÍⲿ³ÌÐò´æ´¢Æ÷ÖÐ, ´Ó1020Hµ¥Ôª¿ªÊ¼ÒÀ´Î´æ·Å0¡«9µÄƽ·½Öµ: 0¡¢ 1¡¢ 4¡¢ 9¡¢ ?¡¢81, ÒªÇóÒÀ¾ÝÀÛ¼ÓÆ÷AÖеÄÖµ£¨0¡«9£©À´²éÕÒËù¶ÔÓ¦µÄƽ·½Öµ, ÊÔÉè¼Æ³ÌÐòʵÏÖ¡£ ´ð£ºMOV DPTR, ££1020H MOVC A, @A+DPTR
11. Éè(R0)=20H, (20H)=40H, (A)=58H, Ôò: Ö´ÐÐ XCH A, @R0 ºó (A)=£¿, (20H)=£¿ ÈôÖ´ÐÐ XCHD A, @R0 ºó (A) =£¿, (20H) =£¿ ´ð£ºÖ´ÐÐ XCH A, @R0 ºó (A)=40H, (20H)=58H ÈôÖ´ÐÐ XCHD A, @R0 ºó (A) =50H, (20H) =48H 12¡¢ÊÔ±àд³ÌÐòÐòÁУ¬Íê³ÉÁ½¸ö16λÊýµÄ¼õ·¨£º£¨30H£©(31H)£(10H)(11H) ¡ú£¨30H£©(31H)¡£ ´ð£ºCLR C
MOV A,31H SUBB A,11H MOV 31H,A MOV A,30H SUBB A,10H MOV 30H,A
13¡¢ÊÔ±àд³ÌÐò£¬½«R0ÖеĵÍ4λÊýÓëR1Öеĸß4λÊýºÏ²¢³ÉÒ»¸ö8λÊý£¬²¢½«Æä´æ·ÅÔÚR0ÖС£
´ð£ºMOV A,R0
ANL A,#0FH MOV B,A MOV A,R1 ANL A,#0F0H ORL A,B MOV R0,A
14. Éè¼ÆË«×Ö½ÚÎÞ·ûºÅÊý¼Ó·¨³ÌÐòʵÏÖ(R0 R1)+(R2 R3) ¡ú (R4 R5), R0¡¢ R2¡¢ R4´æ·Å16λÊýµÄ¸ß×Ö½Ú, R1¡¢ R3¡¢ R5´æ·ÅµÍ×Ö½Ú£¬¼ÙÉèÆäºÍ²»³¬¹ý16λ¡£
µÚ 12 Ò³ ¹² 47 Ò³