MOV R7£¬A POP ACC INC A
MOVC A£¬@A+DPTR MOV R6£¬A
SJMP $
TAB£ºDB 00£¬00£¬00£¬01£¬OO£¬04£¬OO£¬09£¬OO£¬16H£¬? DB? 04H£¬00
3.4ÉèÄÚ²¿RAMµÄ20HºÍ21Hµ¥ÔªÖÐÓÐÁ½¸ö´ø·ûºÅÊý£¬½«ÆäÖеĴóÊý´æ·ÅÔÚ22Hµ¥ÔªÖУ¬±à³ö³ÌÐò¡£
3.4 ÏÈÓÃÒì»òÖ¸ÁîÅÐÁ½ÊýÊÇ·ñͬºÅ£¬ÔÚͬºÅÖÐÅдóС£¬ÒìºÅÖÐÕýÊýΪ´ó¡£ ORG 0 MOV A£¬20H XRL A£®21H ANL A,#80H JZ CMP
JB 20H.7£¬BG AG£ºMOV 22H£¬20H SJMP $
BG£ºMOV 22H£¬21H
SJMP $
CMP£ºMOV A£¬20H CJNE A£¬21H£¬GR GR£ºJNC AG MOV 22H£¬21H
SJMP $
3.5Èôµ¥Æ¬»úµÄ¾§ÕñƵÂÊΪ6MHz£¬ÇóÏÂÁÐÑÓʱ×Ó³ÌÐòµÄÑÓʱʱ¼ä¡£ DELAY: MOV R1,#0F8H LOOP: MOV R3,#0FBH DJNZ R3,$ DJNZ R1,LOOP RET
3.5 fosc=6MHz£¬MC=2us
»úÆ÷ÖÜÆÚÊý DELAY£ºMOV R1£¬#OF8H 1 LOOP£º MOV R3£¬#0FBH 1 DJNZ R3£¬$ 2 DJNZ R1£¬LOOP 2
RET 2 (1+2+(1+2¡Á251+2)¡Á248)¡Á2us=250.48ms
3.6 ±à³Ì½«ÄÚ²¿Êý¾Ý´æ´¢Æ÷20H¡«24Hµ¥ÔªÑ¹ËõµÄBCDÂëת»»³ÉASCIIÂë´æ·ÅÔÚ25H¿ªÊ¼µÄµ¥ÔªÄÚ¡£
3.6 ½«´ýת»»µÄÊý·ÖÀë³ö¸ß°ë×Ö½Ú²¢ÒƵ½µÍ4λ¼Ó30H£»ÔÙ½«´ýת»»µÄÊý·ÖÀë³öµÍ°ë×Ö½Ú²¢¼Ó30H£¬°²ÅźÃÔ´µØÖ·ºÍת»»ºóÊýµÄµØÖ·Ö¸Õ룬ÖúÃÑ»·´ÎÊý¡£ ORG 0000H
9
MOV R7£¬#05H MOV RO£¬#20H
MOV R1£¬#25H NET£ºMOV A£¬@RO ANL A,#OFOH SWAP
ADD A,#30H MOV @R1£¬A INC R1
MOV A£¬@RO ANL A£¬#OFH ADD A£¬#30H MOV @R1£¬A INC R0 INC R1
DJNZ R7£¬NE SJMP $ END
3.7 ´ÓÄÚ²¿´æ´¢Æ÷30Hµ¥Ôª¿ªÊ¼£¬ÓÐ16¸öÊý¾Ý£¬ÊÔ±àÒ»¸ö³ÌÐò£¬°ÑÆäÖеÄÕýÊý¡¢¸ºÊý·Ö±ðËÍ40HºÍ50H¿ªÊ¼µÄ´æ´¢µ¥Ôª£¬²¢·Ö±ð½«ÕýÊý¡¢¸ºÊýºÍÁãµÄ¸öÊýËÍR4£¬R5£¬R6¡£ 3.7 ƬÄÚRAM¼äÖ·¼Ä´æÆ÷Ö»ÓÐRoºÍR1£¬¶øÕýÊý¡¢¸ºÊýºÍÁã¹²Ðè3¸ö¼Ä´æÆ÷ָʾµØÖ·£¬Õâʱ¿ÉÓöÑÕ»Ö¸ÕëָʾµÚ3¸öµØÖ·£¬POPºÍPUSHÖ¸Áî¿É×Ô¶¯Ð޸ĵØÖ·¡£ROÖ¸ÕýÊý´æ·ÅµØÖ·£¬RlÖ¸¸ºÊý´æ·ÅµØÖ·£¬SPÖ¸Ô´Êý¾Ý´æ·ÅµÄÄ©µØÖ·£¬POPÖ¸ÁîÈ¡Ô´Êý¾Ý£¬Ã¿È¡Ò»¸öÊýµØÖ·¼õ1¡£ ORG 0000H MOV R7£¬#10H MOV A£¬#0 MOV R4,A MOV R5,A MOV R6,A MOV R0£¬#40H MOV R1£¬#50H
MOV SP£¬#2FH NEXT£ºPOP ACC JZ ZER0 JB ACC.7£¬NE INC R4 MOV @RO£¬A INC R0 AJMP DJ NE£ºINC R5 MOV @R1£¬A INC R1
AJMP DJ ZER0£ºINC R6
DJ£ºDJNZ R7£¬NEXT
10
SJMP $ END
3.8 ÄÚ²¿´æ´¢µ¥Ôª40HÖÐÓÐÒ»¸öASCII×Ö·û£¬ÊÔ±àÒ»¸ö³ÌÐò¸ø¸ÃÊýµÄ×î¸ßλ¼ÓÉÏÆæУÑé¡£ 3.8 ¿ÉÖ±½ÓÓÃP±êÖ¾ÅжÏ(JB P£¬ret) ORG 0000H MOV A¡£40H
JB P£¬EN £»ÆæÊý¸ö1תÒÆ
0RL A£¬#80H £»Å¼Êý¸ö1×î¸ßλ¼Ó¡°1¡± EN£ºSJMP$
3.9 ±àдһ¶Î³ÌÐò£¬½«´æ·ÅÔÚ×ÔDATAµ¥Ôª¿ªÊ¼µÄÒ»¸öËÄ×Ö½ÚÊý(¸ßλÔڸߵØÖ·)È¡²¹ºóËÍ»ØÔµ¥Ôª¡£
3.9 È¡²¹²»Í¬ÓÚÇó²¹Â룬Çó²¹ÂëÓ¦Çø±ðÕý¡¢¸ºÊý·Ö±ð´¦Àí£¬¶øÈ¡²¹²»·ÖÕý¡¢¸º£¬ÒòÕý¡¢¸ºÊý¾ùÓÐÏà¶ÔÓÚÄ£µÄ²¹Êý¡£¿ÉÓÃÈ¡·´¼ÓlÇó²¹£¬Ò²¿ÉÓÃÄ£(00H)¼õ¸ÃÊýµÄ·½·¨Ç󲹡£
ORG 0000H MOV R7£¬#03H MOV R0£¬#DATA MOV A£¬@RO CPL A ADD A£¬#01 MOV @RO£¬A AB£ºINC RO MOV A£¬@RO CPL A ADDC A£¬#O DJNZ R7£¬AB SJMP $
3.10 ÒÔBUFlΪÆðʼµØÖ·µÄÍâ´æ´¢ÇøÖУ¬´æ·ÅÓÐ16¸öµ¥×Ö½ÚÎÞ·ûºÅ¶þ½øÖÆÊý£¬ÊÔ±àÒ»¸ö³ÌÐò£¬ÇóÆäƽ¾ùÖµ²¢ËÍBUF2µ¥Ôª£¬ÓàÊý´æÔÚBUF2¡ª1µ¥Ôª¡£ 3.10 16¸öµ¥×Ö½ÚÀÛ¼ÓÓ¦ÓÃADDÖ¸Áî¶ø²»ÄÜÓÃADDCÖ¸ÁºÍµÄµÍλ´æA£¬µ±ºÍ³¬¹ýÒ»¸ö×Ö½Úʱ£¬ºÍµÄ¸ß×Ö½Ú´æÓÚB£¬²¢Òª¼ÓµÍλÏà¼Óʱ²úÉúµÄ½ø룬16¸öµ¥×Ö½Ú¼ÓÍêºó£¬²ÉÓÃÓÒÒÆ4´Î½øÐгý16Çóƽ¾ùÖµµÄÔËË㣬ÉÌÔÚ BUF2µ¥Ôª£¬ÓàÊýÔÚBuF2-1µ¥Ôª¡£ 0RG 0000H MoV R7£¬#0FH MOV R0£¬#BUFl MOV B£¬#0 MOV A£¬@R0
MOV R2,A
NEXT£ºMOV A£¬R2 INC R0 ADD A£¬@R0 MOV R2£¬A MOV A£¬B ADDC A£¬#0 MOV B£¬A
11
DJNZ R7£¬NEXT £»ÒÔÉÏÍê³ÉÇóºÍ MOV R6£¬#04H MOV BUF2£¬A
MOV BUF2-1,#O NEX£ºCLR C MOV A£¬B RRC A MOV B,A MOV A£¬BUF2 RRC A
MOV BUF2£¬A MOV A£¬BUF2-1 RRC A
MOV BUF2-l£¬A DJNZ R6£¬NEX SJMP $
£»ÒÔÉÏÍê³É³ý16ÔËËã
3.11 ½«ÄÚ²¿RAMµÄ20Hµ¥ÔªÖеÄÊ®Áù½øÖÆÊý±ä»»³ÉASCII´æÈë22H£¬21Hµ¥Ôª£¬¸ßλ´æÈë22Hµ¥Ôª£¬ÒªÇóÓÃ×Ó³ÌÐò±àдת»»²¿·Ö¡£
3.11 ½«20Hµ¥ÔªµÄÄÚÈÝ·Ö½âΪ¸ß4λºÍµÍ4룬¸ù¾ÝÊÇ·ñ´óÓÚ9·Ö±ð½øÐмÓ37HºÍ30H´¦Àí¡£
0RG 0000H MOV A,20H ANL A£¬#0F0H SWAP A
ACALL ASCII MOV 22H£¬A MOV A£®20H ANL A£¬#0FH ACALL ASCII MOV 21H£¬A SJMP $ END
ASCII£ºCJNE A£¬#0AH£¬NE NE£ºJC A30 ADD A£¬#37H RET
A30£ºADD A£¬30H RET
3.12 ±àдһ¶Î³ÌÐò£¬ÒÔʵÏÖͼÖÐÓ²¼þµÄÂß¼ÔËË㹦ÄÜ¡£
12