QIAN EQU 40H
HOU EQU 41H
JIA EQU 42H
JIAN EQU 43H
TING EQU 44H
ORG 000H
LJMP MAIN
ORG 003H
LJMP DUAN /// 外部中断0
ORG 0030H
MAIN: ///初始化
MOV R0,#0FH
MOV 10H,#01H
MOV 11H,#03H
MOV 12H,#02H
MOV 13H,#06H
MOV 14H,#04H
MOV 15H,#0CH
MOV 16H,#08H
MOV 17H,#09H
MOV 20H,#50
MOV 21H,#40
MOV 22H,#30
MOV 23H,#20
MOV 24H,#10
MOV 25H,#5
MOV R1,#20H
MOV IE,#10000001B
CLR QIAN
CLR HOU
CLR JIA
CLR JIAN
CLR TING
MOV A,@R1
MOV R2,A
SETB IT0 ////边沿触发形式
LOOP1:JNB QIAN ,LOOP2
ACALL FRONT1
LOOP2:JNB HOU,LOOP1
ACALL BACK1
DUAN: MOV A,P0
CPL A
ANL A,#1FH ///去高三位,使按下去的一位为1
CJNE A,#00H,CHA
AJMP DUAN
CHA: ACALL DELAY10MS
MOV A,P0
CPL A
ANL A,#1FH
JZ DUAN ///为零转移
ACALL ZHAO
RETI
ZHAO:MOV A,P0 //查找是哪一位,下面置1
JNB ACC.0,FRONT
JNB ACC.1,BACK
JNB ACC.2,FAST
JNB ACC.3,SLOW
JNB ACC.4,STOP
FRONT:SETB QIAN
RET
BACK: SETB HOU
RET
FAST: SETB JIA
RET
SLOW: SETB JIAN
RET
STOP: SETB TING
RET
FRONT1:CLR QIAN
CLR HOU
CLR JIA
CLR JIAN
CLR TING
INC R0 ///前进子程序 R0用于给P2口送不同的值
MOV P2,@R0
MOV A,@R1
MOV R2,A /// R2用于延时不同的时间
ACALL DELAY
CJNE R0,#17H,XIA
MOV R0,#10H
XIA: JB QIAN,HUI //回主程序////////XIA子程序用于过度
JB HOU, HUI
JB TING,HUI
JNB JIA,XIA1
ACALL JIA1
XIA1: JNB JIAN,XIA2 ///XIA子程序用于过度
ACALL JIAN1
JB TING ,HUI
XIA2: AJMP FRONT1
HUI : RET //返回主程序
JIA1: CJNE R1,#25H,XIA3 /// 加速
RET
XIA3: INC R1
RET
BACK1: CLR QIAN //后退
CLR HOU
CLR JIA
CLR JIAN
CLR TING
CJNE R0,#0FH ,XIA8
MOV R0,#17H
XIA8: DEC R0
MOV P2,@R0
MOV A,@R1
MOV R2,A
ACALL DELAY
CJNE R0,#10H,XIA5
MOV R0,#17H
XIA5: JB QIAN,HUI
JB TING,HUI
JB HOU ,HUI
JNB JIA, XIA6
ACALL JIA1
XIA6: JNB JIAN,XIA7
ACALL JIAN1
XIA7: AJMP BACK1
JIAN1: CJNE R1,#20H,XIA4 //减速
RET
XIA4: DEC R1
RET
DELAY10MS:
MOV R3,#20
D1: MOV R4,#250
DJNZ R4,$
DJNZ R3,D1
RET
DELAY: MOV R5,#50 //根据r2的状态调整 步进电机的每一步的时间
D2: MOV R6,#150
D3: DJNZ R6,$
DJNZ R5,D2
DJNZ R2,DELAY
RET
END
原理图和程序如上,请问怎么加LED显示,本人在这方面不是很明白,请大家帮帮忙谢谢了