基于单片机的直流电机pwm调速系统设计!!!!!!!!!!!

邮箱:546664974@QQ.COM 谢谢!!!!!!!
2024-12-17 03:53:58
推荐回答(1个)
回答1:

用89C51编的程,步进电机调速,看你能不能用到
ORG 0000H
LJMP MAIN
ORG 001BH
LJMP LOOP
ORG 0100H
MAIN: MOV R0,#08H
MOV P0,#0FFH
MOV TMOD,#10H
JB P1.6,SK7
MOV DPTR,#FORWARD
SJMP SUDU
SK7: JNB P1.7,SK6
SJMP MAIN
SK6: MOV DPTR,#REVERSE
SUDU:JNB P1.0,L0
JNB P1.1,L1
JNB P1.2,L2
JNB P1.3,L3
JNB P1.4,L4
JNB P1.5,L5
SJMP MAIN
L0: MOV TL1,#00H
MOV TH1,#00H
SJMP LOOP1
L1: MOV TL1,#22H
MOV TH1,#22H
SJMP LOOP1
L2: MOV TL1,#44H
MOV TH1,#44H
SJMP LOOP1
L3: MOV TL1,#66H
MOV TH1,#66H
SJMP LOOP1
L4: MOV TL1,#88H
MOV TH1,#88H
SJMP LOOP1
L5: MOV TL1,#0AAH
MOV TH1,#0AAH
LOOP1: MOV IE,#88H
SETB TR1
SJMP $
FORWARD: DB 0EH,0CH,0DH,09H,0BH,03H,07H,06H
REVERSE: DB 06H,07H,03H,0BH,09H,0DH,0CH,0EH
LOOP:JNB P1.0,L01
JNB P1.1,L11
JNB P1.2,L21
JNB P1.3,L31
JNB P1.4,L41
JNB P1.5,L51
SJMP LOOP
L01: MOV TL1,#00H
MOV TH1,#00H
SJMP LOOP2
L11: MOV TL1,#22H
MOV TH1,#22H
SJMP LOOP2
L21: MOV TL1,#44H
MOV TH1,#44H
SJMP LOOP2
L31: MOV TL1,#66H
MOV TH1,#66H
SJMP LOOP2
L41: MOV TL1,#88H
MOV TH1,#88H
SJMP LOOP2
L51: MOV TL1,#09FH
MOV TH1,#09FH
LOOP2:MOV A,#00H
MOVC A,@A+DPTR
MOV P0,A
INC DPTR
DJNZ R0,LOOP3
MOV R0,#08H
JB P1.6,SK72
MOV DPTR,#FORWARD
SJMP LOOP3
SK72: JNB P1.7,SK62
SJMP LOOP
SK62: MOV DPTR,#REVERSE
LOOP3: RETI
END