求汇编大神
源程序:
ORG 0000H
AJMP MAIN
ORG 0003H
AJMP DET1 ;远探测器
ORG 0013H
AJMP DET0 ;近探测器
ORG 0050H
MAIN: MOV P0, #00000001B ;置初始值DET0,DET1可重复触发,灯灭
MOV TMOD, #00000010B ;方式2,8位自动重装计数器
MOV TCON, #00010000B ;开启计数器T0
MOV IE, #10000111B ;开启所有中断
SJMP $
;灯慢慢变亮
DET1: MOV P0, #00000001B
CALL TIME0 ;灯亮度延时10ms
MOV P0, #00000011B
CALL TIME0
MOV P0, #00000101B
CALL TIME0
MOV P0, #00000111B
CALL TIME0
MOV P0, #00001001B
CALL TIME0
MOV P0, #00001011B
CALL TIME0
MOV P0, #00001101B
CALL TIME0
MOV P0, #00001111B
CALL TIME1
RETI
;灯慢慢熄灭
DET0: CALL TIME1 ;延时1分钟
MOV TCON, A
ANL A, #1
JZ LOOP
MOV P0, #00001111B
CALL TIME0
MOV P0, #00001101B
CALL TIME0
MOV P0, #00001011B
CALL TIME0
MOV P0, #00001001B
CALL TIME0
MOV P0, #00000111B
CALL TIME0
MOV P0, #00000101B
CALL TIME0
MOV P0, #00000011B
CALL TIME0
MOV P0, #00000001B
RETI
LOOP: ret
;延时10ms
TIME0: SETB TR0
MOV R0, #250
MOV R1, #20
D_1: DJNZ R0, D_1
MOV R0, #250
DJNZ R1, D_1
CLR TR0
RET
;延时1分钟
TIME1: SETB TR0
MOV R0, #250
MOV R1, #200
MOV R2, #60
D_2: DJNZ R0, D_2
MOV R1, #200
DJNZ R1, D_2
MOV R2, #60
DJNZ R2, D_2
CLR TR0
RET
END
求改为c语言版
求改为C语言版
汇编大神来了~