huiyen
Newbie level 4
I had write the program for the dc servo motor. The program such as below.As a result the servo motor's shaft was rotate continuously. I want to ask if i want to stop the motor when the motor's shaft has move 90 angle degree. How can i control it by 8051?
CPU "8051.TBL"
INCL "8051.INC"
ORG 0000H
MOV TMOD,#00000001B
LOOP: SETB P1.0
CALL DELAY
CLR P1.0
CALL DELAY
JMP LOOP
DELAY: MOV TH0,#0FEH
MOV TL0,#31H
SETB TR0
JNB TF0,$
CLR TR0
CLR TF0
RET
CPU "8051.TBL"
INCL "8051.INC"
ORG 0000H
MOV TMOD,#00000001B
LOOP: SETB P1.0
CALL DELAY
CLR P1.0
CALL DELAY
JMP LOOP
DELAY: MOV TH0,#0FEH
MOV TL0,#31H
SETB TR0
JNB TF0,$
CLR TR0
CLR TF0
RET