兄弟们 我的汇编程序出现了一个错误 大家都来看看
时间:10-02
整理:3721RD
点击:
我这里用汇编编写一个51的程序 提示了一个错误 但是我觉得是没有错误的 麻烦你帮看看
这是错误提示:shishi.asm(58): error A48: DATA-ADDRESS EXPECTED
它指向下面这句话:MOV 20H.0,INTA
其中INTA是这样定义的:INTA equ p3.4
我觉得不应该有错误了
总的程序如下:
INA equ p3.4 ;1aμ??a1?A ±?à′AB?aμ?í¨×′ì?
INB equ p3.7 ;1aμ??a1?B
out1 equ p2.0 ;μ?′?·§?ìμ??÷
out2 equ p2.7 ;μ??e?ìμ??÷
out3 equ p2.1 ;1?·??ú?÷?ìμ??÷,0:open;1:close
out4 equ p2.5 ;1?·??ú??μí?ù?D???ìμ??÷,0:low;1:high
org 0000h //3ìDò?ú0000hoó?aê?
ajmp 0030h //μ÷μ??÷3ìDò 00μ?30????ê??D??oˉêyμ?è??ú ?÷3ìDò?ú30??oó ?ùò?òaì?×a
org 0030h //3ìDò?ú?÷3ìDò?′DD
START:
MOV SP,#60H //éè????????????′??÷ ???μ?a60
MOV IP,#00H //éè???D??ó??è????′??÷ ?ùóD?D??μ?ó??è?????a×?????
MOV IE,#00H //éè???D??ê1?ü??′??÷ ???1?ùóDμ??D??
MOV 20H,#00H //3?ê??ˉ20H 21H 22Hí¨ó???′??÷
MOV 21H,#00H
MOV 22H,#00H
CLR OUT1 //??á?p2.0 μ?′?·§?ìμ??÷
CLR OUT2 //??á?p2.7 μ??e?ìμ??÷
CLR OUT3 //??á?p2.1 1?·??ú?÷?ìμ??÷,0:open;1:close
CLR OUT4 //??á?1?·??ú??μí?ù?D???ìμ??÷,0:low;1:high
main:
LCALL D4300MS //μ÷ó?D4300MS 3¤μ÷ó? ×ó3ìDò×?′ó?a64KB
MOV 22H,21H //°?21Hμ??μ?′??μ?22H
MOV 21H,20H
ACALL READIN //????μ÷ó? ×ó3ìDò×?′ó?a2KB
STAT3:
;JB 22H.1,STAT4 ;B???a
JB 21H.1,STAT4 ;B???a ?a1×aò?
JB 20H.1,STAT4 ;B???a
AJMP NEXT
STAT4:
JNB 21H.0,A0B0 ;Aμ?í¨×aò? 2??a1×aò?
AJMP MAIN
NEXT:
JB 20H.0,A1B0 ;A???a×aò? ?a1×aò?
A0B0: ;Aμ?í¨Bμ?í¨
CLR OUT1 ;μ?′?·§í¨μ?
CLR OUT2 ;μ??e??2?í¨μ?
CLR OUT3 ;1?·??ú?a
CLR OUT4 ;1?·??úμí?ù??DD
AJMP MAIN
A1B0: ;A???aBμ?í¨
SETB OUT1 ;μ?′?·§??μ?
SETB OUT2 ;μ??e??í¨μ?
ACALL D700MS ;?óê±0.7??
CLR OUT3 ;1?·??ú?a
SETB OUT4 ;1?·??ú???ù??DD
ACALL D4300MS;?óê±4.3??
CLR OUT2 ;μ??e??2?í¨μ?
AJMP MAIN
E_MAIN:
AJMP MAIN
;READ INPUT
READIN: ;ABde×′ì?é¨?è3ìDò ?aê?ê±AB??μèóú0 μ±óD±??ˉμ?ê±oòí?3? μ?2¢2??aμàê?????±??ˉá? ±??ˉá??í?μ?÷ABóDò???±??a1á?
MOV 20H,#00H ;3?ê??ˉ20H
SETB INA ;????INA òa?áIO?ú?í±?D??è??????IO?ú p3.4 1aμ??a1?A
MOV 20H.0,INA ;°?INA p3.4 1aμ??a1?A μ?×′ì?±£′?μ?20H.0
SETB INB
MOV 20H.1,INB ;°?p3.7 1aμ??a1?Bμ?×′ì?±£′?μ?20H.1
MOV A,20H ;°?20Hμ?êy?Y×aò?μ?à??ó?÷A?D
MOV R7,#10H ;°?10·?μ?R7à?
DJNZ R7,$ ;?-?·16′? ?óê±16′?
MOV 20H,#00H ;??3y20H êy?Yò??-ò?????A
SETB INA ;?ù′???è?Aμ?ê?è?
MOV 20H.0,INA
SETB INB
MOV 20H.1,INB
CJNE A,20H,READIN ;Compare Jump Not Equal ±è??2??àμè×aò???á? 20Hà?μ?êy?μoíA±è?? è?2??àμè?ò×aò?μ?READIN?′±?3ìDò?aí· ?ù′?é¨?è ±ü?a?éè? 2??àμè?ò?μ?÷ê???éù ?a???°μ?×÷ó??í??ê??μ?÷??óD??éù°?á?
CJNE A,21H,E_READIN ;×aò?μ?ê±oòμ÷ó?í?3???á? í?3?READIN ?íê??μμ±21Hμ??μoíA2??àμèμ?ê±oòí?3?READIN MOV 21H,20H 21Hμ??úèY?a00 óDò???μ?í¨í?3? ?a???°2?ê??D??óD??óD±??ˉ
AJMP READIN ;?Tì??t×aò???READIN oˉêy?aê? ?ù′??-?·é¨?è
READ_B: ;B???a,0.7???ú?áAê?·?μ?í¨±??a0£? A?úINAμèóú1μ?ê±oòμ?í¨ μ?í¨?a1 ???a?a0
JNB 20H.1,READ_A ;B???a íù??×? ??ì??t×aò? ???a0ê±×aò? Bμ?×′ì?′?·??ú20H.1à??? è?20H.1μèóú0?ò×aò?μ?READ_A ·??ò?3Dò?′DD 20H.1μèóú0?ò?μ?÷±??ˉμ?2?ê?B ±?à′ê????aμ??′0?ùò??μê?Aμ?í¨
RAL: MOV R5,#7 ;×°??R5.6.7
RAL3: MOV R6,#95
RAL2: MOV R7,#210 ;μ?í¨?a0 ???a?a1
RAL1: SETB INA ;°?A??ò? ??ò?2??íòa?áè?Aμ??μ μ±Aμ?í¨ê? INAμèóú0
JNB INA,SAV4 ;A???aíù??×? μ?í¨μ?ê±oò×aò? ?±?ó?°?·2??a1ê±×aò? è?1?INAμèóú0 ×aò?μ?SAV4 ??òaAμ?í¨£¨±??a0£? ?íì?3??á3? μ±è?3?ê±μ?ê±oòò2?áì?3?
DJNZ R7,RAL1 ;R7??12??a0 ì?×a ?′DD7 210+210*95+7*210*95=159810′?
DJNZ R6,RAL2
DJNZ R5,RAL3
AJMP E_READIN ;3?ê± ì?×aμ?E_READIN
READ_A: ;Aμ?í¨,0.7???ú?áBê?·????a
JB 20H.0,E_READIN ;μ±Aμ?í¨μ?ê±oò×aò? ???a1×aò?
RBL: MOV R5,#7
RBL3: MOV R6,#95
RBL2: MOV R7,#210
RBL1: SETB INB
JB INB,SAV4 ;μ±Bμ?í¨μ?ê±oò×aò? μ?í¨?a0 ???a?a1 ???a1×aò?
DJNZ R7,RBL1
DJNZ R6,RBL2
DJNZ R5,RBL3
AJMP E_READIN
SAV4: ;B???a,Aμ?í¨
CLR 20H.0
SETB 20H.1
E_READIN:
RET
;?óê±0.7??
d700ms: mov r5, #7 ;°?7×°μ?r5?D
d100ms: mov r6, #199
d500us: mov r7, #250 ;°?250×°è?r7?D d500us?′DDá?
djnz r7, $ ;??12??aá?×aò???á? dec 1 jump if not zero ?è??r7μ?êy??1 ?D??ê?·??a0 2??a0?íì?μ?DD±ê?aRELμ?μ?·??′DD ?a0?í2?×aò? ?ìD??′DD????μ?ó???
djnz r6, d500us ;2??aá??íì?μ?d500usμ?μ?·??ìD??′DD ò2?íê??ù??250′? ò?12??250*199=49750′?
djnz r5, d100ms ;oíé???ò??ù ò?12??á?250+199*250+7*199*250=398250′?
RET
;?óê±4.3??
d4300ms:mov r5, #43
d100ms1:mov r6, #198
d500us1:mov r7, #251
djnz r7, $ ;±ê??·?$ ê?±?ì???á?μ??eê?μ??·μ?òa?? ?íê??μè?1?r7??12??aá? ???′ó??ìD??′DD±?ì???á??íê?ò????óê± DINZμ?oˉêy?¨ò?£oDJNZ Rn, Rel
djnz r6, d500us1
djnz r5, d100ms1
RET
END
这是错误提示:shishi.asm(58): error A48: DATA-ADDRESS EXPECTED
它指向下面这句话:MOV 20H.0,INTA
其中INTA是这样定义的:INTA equ p3.4
我觉得不应该有错误了
总的程序如下:
INA equ p3.4 ;1aμ??a1?A ±?à′AB?aμ?í¨×′ì?
INB equ p3.7 ;1aμ??a1?B
out1 equ p2.0 ;μ?′?·§?ìμ??÷
out2 equ p2.7 ;μ??e?ìμ??÷
out3 equ p2.1 ;1?·??ú?÷?ìμ??÷,0:open;1:close
out4 equ p2.5 ;1?·??ú??μí?ù?D???ìμ??÷,0:low;1:high
org 0000h //3ìDò?ú0000hoó?aê?
ajmp 0030h //μ÷μ??÷3ìDò 00μ?30????ê??D??oˉêyμ?è??ú ?÷3ìDò?ú30??oó ?ùò?òaì?×a
org 0030h //3ìDò?ú?÷3ìDò?′DD
START:
MOV SP,#60H //éè????????????′??÷ ???μ?a60
MOV IP,#00H //éè???D??ó??è????′??÷ ?ùóD?D??μ?ó??è?????a×?????
MOV IE,#00H //éè???D??ê1?ü??′??÷ ???1?ùóDμ??D??
MOV 20H,#00H //3?ê??ˉ20H 21H 22Hí¨ó???′??÷
MOV 21H,#00H
MOV 22H,#00H
CLR OUT1 //??á?p2.0 μ?′?·§?ìμ??÷
CLR OUT2 //??á?p2.7 μ??e?ìμ??÷
CLR OUT3 //??á?p2.1 1?·??ú?÷?ìμ??÷,0:open;1:close
CLR OUT4 //??á?1?·??ú??μí?ù?D???ìμ??÷,0:low;1:high
main:
LCALL D4300MS //μ÷ó?D4300MS 3¤μ÷ó? ×ó3ìDò×?′ó?a64KB
MOV 22H,21H //°?21Hμ??μ?′??μ?22H
MOV 21H,20H
ACALL READIN //????μ÷ó? ×ó3ìDò×?′ó?a2KB
STAT3:
;JB 22H.1,STAT4 ;B???a
JB 21H.1,STAT4 ;B???a ?a1×aò?
JB 20H.1,STAT4 ;B???a
AJMP NEXT
STAT4:
JNB 21H.0,A0B0 ;Aμ?í¨×aò? 2??a1×aò?
AJMP MAIN
NEXT:
JB 20H.0,A1B0 ;A???a×aò? ?a1×aò?
A0B0: ;Aμ?í¨Bμ?í¨
CLR OUT1 ;μ?′?·§í¨μ?
CLR OUT2 ;μ??e??2?í¨μ?
CLR OUT3 ;1?·??ú?a
CLR OUT4 ;1?·??úμí?ù??DD
AJMP MAIN
A1B0: ;A???aBμ?í¨
SETB OUT1 ;μ?′?·§??μ?
SETB OUT2 ;μ??e??í¨μ?
ACALL D700MS ;?óê±0.7??
CLR OUT3 ;1?·??ú?a
SETB OUT4 ;1?·??ú???ù??DD
ACALL D4300MS;?óê±4.3??
CLR OUT2 ;μ??e??2?í¨μ?
AJMP MAIN
E_MAIN:
AJMP MAIN
;READ INPUT
READIN: ;ABde×′ì?é¨?è3ìDò ?aê?ê±AB??μèóú0 μ±óD±??ˉμ?ê±oòí?3? μ?2¢2??aμàê?????±??ˉá? ±??ˉá??í?μ?÷ABóDò???±??a1á?
MOV 20H,#00H ;3?ê??ˉ20H
SETB INA ;????INA òa?áIO?ú?í±?D??è??????IO?ú p3.4 1aμ??a1?A
MOV 20H.0,INA ;°?INA p3.4 1aμ??a1?A μ?×′ì?±£′?μ?20H.0
SETB INB
MOV 20H.1,INB ;°?p3.7 1aμ??a1?Bμ?×′ì?±£′?μ?20H.1
MOV A,20H ;°?20Hμ?êy?Y×aò?μ?à??ó?÷A?D
MOV R7,#10H ;°?10·?μ?R7à?
DJNZ R7,$ ;?-?·16′? ?óê±16′?
MOV 20H,#00H ;??3y20H êy?Yò??-ò?????A
SETB INA ;?ù′???è?Aμ?ê?è?
MOV 20H.0,INA
SETB INB
MOV 20H.1,INB
CJNE A,20H,READIN ;Compare Jump Not Equal ±è??2??àμè×aò???á? 20Hà?μ?êy?μoíA±è?? è?2??àμè?ò×aò?μ?READIN?′±?3ìDò?aí· ?ù′?é¨?è ±ü?a?éè? 2??àμè?ò?μ?÷ê???éù ?a???°μ?×÷ó??í??ê??μ?÷??óD??éù°?á?
CJNE A,21H,E_READIN ;×aò?μ?ê±oòμ÷ó?í?3???á? í?3?READIN ?íê??μμ±21Hμ??μoíA2??àμèμ?ê±oòí?3?READIN MOV 21H,20H 21Hμ??úèY?a00 óDò???μ?í¨í?3? ?a???°2?ê??D??óD??óD±??ˉ
AJMP READIN ;?Tì??t×aò???READIN oˉêy?aê? ?ù′??-?·é¨?è
READ_B: ;B???a,0.7???ú?áAê?·?μ?í¨±??a0£? A?úINAμèóú1μ?ê±oòμ?í¨ μ?í¨?a1 ???a?a0
JNB 20H.1,READ_A ;B???a íù??×? ??ì??t×aò? ???a0ê±×aò? Bμ?×′ì?′?·??ú20H.1à??? è?20H.1μèóú0?ò×aò?μ?READ_A ·??ò?3Dò?′DD 20H.1μèóú0?ò?μ?÷±??ˉμ?2?ê?B ±?à′ê????aμ??′0?ùò??μê?Aμ?í¨
RAL: MOV R5,#7 ;×°??R5.6.7
RAL3: MOV R6,#95
RAL2: MOV R7,#210 ;μ?í¨?a0 ???a?a1
RAL1: SETB INA ;°?A??ò? ??ò?2??íòa?áè?Aμ??μ μ±Aμ?í¨ê? INAμèóú0
JNB INA,SAV4 ;A???aíù??×? μ?í¨μ?ê±oò×aò? ?±?ó?°?·2??a1ê±×aò? è?1?INAμèóú0 ×aò?μ?SAV4 ??òaAμ?í¨£¨±??a0£? ?íì?3??á3? μ±è?3?ê±μ?ê±oòò2?áì?3?
DJNZ R7,RAL1 ;R7??12??a0 ì?×a ?′DD7 210+210*95+7*210*95=159810′?
DJNZ R6,RAL2
DJNZ R5,RAL3
AJMP E_READIN ;3?ê± ì?×aμ?E_READIN
READ_A: ;Aμ?í¨,0.7???ú?áBê?·????a
JB 20H.0,E_READIN ;μ±Aμ?í¨μ?ê±oò×aò? ???a1×aò?
RBL: MOV R5,#7
RBL3: MOV R6,#95
RBL2: MOV R7,#210
RBL1: SETB INB
JB INB,SAV4 ;μ±Bμ?í¨μ?ê±oò×aò? μ?í¨?a0 ???a?a1 ???a1×aò?
DJNZ R7,RBL1
DJNZ R6,RBL2
DJNZ R5,RBL3
AJMP E_READIN
SAV4: ;B???a,Aμ?í¨
CLR 20H.0
SETB 20H.1
E_READIN:
RET
;?óê±0.7??
d700ms: mov r5, #7 ;°?7×°μ?r5?D
d100ms: mov r6, #199
d500us: mov r7, #250 ;°?250×°è?r7?D d500us?′DDá?
djnz r7, $ ;??12??aá?×aò???á? dec 1 jump if not zero ?è??r7μ?êy??1 ?D??ê?·??a0 2??a0?íì?μ?DD±ê?aRELμ?μ?·??′DD ?a0?í2?×aò? ?ìD??′DD????μ?ó???
djnz r6, d500us ;2??aá??íì?μ?d500usμ?μ?·??ìD??′DD ò2?íê??ù??250′? ò?12??250*199=49750′?
djnz r5, d100ms ;oíé???ò??ù ò?12??á?250+199*250+7*199*250=398250′?
RET
;?óê±4.3??
d4300ms:mov r5, #43
d100ms1:mov r6, #198
d500us1:mov r7, #251
djnz r7, $ ;±ê??·?$ ê?±?ì???á?μ??eê?μ??·μ?òa?? ?íê??μè?1?r7??12??aá? ???′ó??ìD??′DD±?ì???á??íê?ò????óê± DINZμ?oˉêy?¨ò?£oDJNZ Rn, Rel
djnz r6, d500us1
djnz r5, d100ms1
RET
END
这代码长得跟火星文一样,没法看啊
为什么不写成mov 20h.0,p3.4?
为什么不用C语言呢?汇编语言不方便,检查的时候太麻烦了。
MOV 20H.0,INTA。这条语句错误不关定义的事情。因为根本就没有这么一条指令。这条指令时小编自己想当然想出来的。这是位操作,位操作只有两条传输指令,那就是mov c,bit和mov bit,c。因此要先将INTA的值传送给C,再把C的值传给20.0H.就是
- mov c,INTA
- mov 20.0H,c
楼上正解,没有位到位的传输指令
01.mov c,INTA
02.mov 20H.0,c
为什么不写成mov 20h.0,p3.4 这里有问题