哪位大神能帮我修改一下下面的汇编程序,急用,万分感谢。编译是的问题如图所示!!!!!文件在此链接中

http://pan.baidu.com/s/1ntuf1Wl
2024-11-18 10:34:20
推荐回答(1个)
回答(1):

LED_0 EQU 30H
LED_1 EQU 31H
LED_2 EQU 32H
ADC EQU 35H
TCNTA EQU 36H
TCNTB EQU 37H

H_TEMP EQU 46H ; //温度上限
L_TEMP EQU -14H ; //温度下限

FLAG BIT 00H
H_ALM BIT P3.0
L_ALM BIT P3.1

SOUND BIT P3.7

CLOCK BIT P2.4
ST BIT P2.5
EOC BIT P2.6
OE BIT P2.7

ORG 00H
SJMP START
ORG 0BH
LJMP INT_T0
ORG 1BH
LJMP INT_T1
START:
MOV LED_0, #00H
MOV LED_1, #00H
MOV LED_2, #00H
MOV DPTR, #TABLE
MOV H_TEMP, #60
MOV L_TEMP, #30
MOV TMOD, #12H
MOV TH0, #245
MOV TL0, #0
MOV TH1, #(65536-1000)/256
MOV TL1, #(65536-1000) MOD 256
MOV IE, #8aH
CLR C
SETB TR0 ;为ADC0808提供时钟

WAIT:
SETB H_ALM
SETB L_ALM
CLR ST
SETB ST
CLR ST ;启动转换
JNB EOC, $
SETB OE
MOV ADC, P1 ;读取AD转换结果
CLR OE
MOV A, ADC
SUBB A, #30 ;判断是否低于下限
JC LALM
MOV A, H_TEMP
MOV R0, ADC
SUBB A, R0 ;判断是否高于上限
JC HALM
CLR TR1
LJMP PTOC

LALM: ;低温报警
CLR L_ALM
SETB TR1
CLR FLAG
LJMP PTOC

HALM: ;高温报警
CLR H_ALM
SETB TR1
SETB FLAG
LJMP PtOC

PTOC:
MOV A, ADC ;数值转换
MOV B, #100
DIV AB
MOV LED_2, A
MOV A, B
MOV B, #10
DIV AB
MOV LED_1, A
MOV LED_0, B
CALL DISP
SJMP WAIT

INT_T0:
CPL CLOCK ;提供89C51时钟
RETI

INT_T1:
MOV TH1, #(65536-1000)/256
MOV TL1, #(65536-1000) MOD 256
CPL SOUND
INC TCNTA
MOV A, TCNTA
JB FLAG, I1 ;判断是高温警报还是低温警报
CJNE A, #30, RETUNE ;低温警报声
SJMP I2
I1: CJNE A, #20, RETUNE ;高温警报声
I2: MOV TCNTA, #0
INC TCNTB
MOV A, TCNTB
CJNE A, #25, RETUNE
MOV TCNTA, #0
MOV TCNTB, #0
CALL DELAY2
RETUNE:
RETI

DISP:
MOV A, LED_0 ;数码显示子程序
MOVC A, @A+DPTR
CLR P2.3
MOV P0, A
CALL DELAY
SETB P2.3

MOV A, LED_1
MOVC A, @A+DPTR
CLR P2.2
MOV P0, A
CALL DELAY
SETB P2.2

MOV A, LED_2
MOVC A, @A+DPTR
CLR P2.1
MOV P0, A
CALL DELAY
SETB P2.1
RET

DELAY:
MOV R6, #10
D1: MOV R7, #250
DJNZ R7, $
DJNZ R6, D1
RET
DELAY2:
MOV R5, #20
D2: MOV R6, #20
D3: MOV R7, #250
DJNZ R7, $
DJNZ R6, D3
DJNZ R5, D2
RET

TABLE:
DB 3FH, 06H, 5BH, 4FH, 66H
DB 6DH, 7DH, 07H, 7FH, 0FH
END