|
我编写了个光电转速测量程序,但是用keil51调试时老是出现说是code-address expected或者是data-address expexted,不知道这到底是什么问题,下面是我的程序: BUF EQU 5AH
spcoun EQU 59H
COUNT EQU 57H
SPCALC bit 00H
ORG 0000H
AJMP START
ORG 1BH
JMP TL1
START: mov sp,#5FH
MOV P2,#0FFH
MOV P0,#0FFH
MOV TMOD,#25h
MOV TH1, #9CH
MOV TL1, #9CH
SETB TR1
SETB ET1
SETB EA
MOV COUNT,#0H
LOOP: JNB SPCALC,LOOP
mov A, spcoun+1
mov B,#10 ;当有6个叶轮时
mul AB
MOV A,B
MOV R5,#5
SUBB A,R5
JC TCL1
MOV P2.0,#0
JMP CHAGN
TCL1: MOV P2.1,#0
CHAGN: MOV A,SPCOUN
MOV B,#10
DIV AB
MOV DPTR,#DISPTAB
MOVC A, @A+DPTR
MOV BUF,A
MOV A,B
MOVC A,@A+DPTR
MOV BUF+1,A
DISP: MOV R0,#BUF
MOV R2,#2
MOV ACC,#01111111H
S1: PUSH ACC
MOV A,@R0
MOV P0,A
POP ACC
MOV P2,ACC
RR A
INC R0
DJNZ R2,S1
Jmp LOOP
TL1: PUSH ACC
PUSH PSW
CLR ET0
CLR ET1
MOV TL0,#00H
MOV TH0,#00H
MOV TL1,#9CH
MOV TH1,#9CH
MOV R5,#10000
CLR TF1
SETB TR0
SETB TR1
FWAIT: JNB TF0,FWAIT0
FWAIT1: DJNZ R5,FWAIT2
CLR TR0
CLR TR1
MOV spcoun,TH0
MOV spcoun,TL0
CLR A
MOV TH0,A
MOV TL0,A
SETB SPCOUN
MOV COUNT,#0
JMP INTEND
FWAIT2: CLR TF0
FWAIT0: SJMP FWAIT
POP PSW
POP ACC
INTEND: RETI
DISPTAB :DB 0CH,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H,88H,83H,0C6H,0A1H,86H,8EH,0FFH
RET
END
|
|