Showing posts with label stepper motor. Show all posts
Program for half stepper motor
half stepper motor:
ORG 0000H
MOV P2,#00H ;initialize as o/p port
////////////////////////////////////////METHOD-2 HALF STEPPING//////////////////////////////////////////
exit:
mov dptr,#msg
rpt:clr a
movc a,@a+dptr
jz exit
inc dptr
mov p2,a
acall delay
sjmp rpt
/////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////METHOD-1//////////////////////////////////////////
/*MOV A,#66H
AGAIN:MOV P2,A
JNB P1.0,NXT ;check status of switch
RR A
ACALL DELAY
SJMP AGAIN
NXT:RL A
ACALL DELAY
SJMP AGAIN */
/////////////////////////////////////////////////////////////////////////////////////////////
DELAY:
MOV R1,#01H
H3:MOV R2,#0FFH
H2:MOV R3,#0FFH
H1:DJNZ R3,H1
DJNZ R2,H2
DJNZ R1,H3
RET
msg:
db 08h,0ch,04h,06h,02h,03h,01h,09h,0
END
Half stepper motor using 8051
This is the circuit diagram of interfacing of half stepper motor with 8051.

Stepper motors consist of a permanent magnet rotating shaft, known as rotor, and electromagnets on the stationary portion that surrounds the motor, known as stator. You can see in the figure given below. In half stepping rotor moves with 45 degree. At position 1, we see that the rotor is beginning at the upper electromagnet, which is currently active because we have applied voltage. To move the rotor clockwise, the upper electromagnet is still activated and the right electromagnet is activated also, causing the rotor to move 45 degrees clockwise, aligning itself with the active magnet because both stator attracts rotor with same force. This process is repeated in the same manner at the south and west electromagnets until we once again reach the starting position.
Program for full stepper motor
full stepper motor:
ORG 0000H
MOV P2,#00H ;initialize as op port
/*
////////////////////////////////////////METHOD-2 HALF STEPPING//////////////////////////////////////////
exit:
mov dptr,#msg
rpt:clr a
movc a,@a+dptr
jz exit
inc dptr
mov p2,a
acall delay
sjmp rpt */
/////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////METHOD-1//////////////////////////////////////////
MOV A,#66H
AGAIN:MOV P2,A
JNB P1.0,NXT ;check status of switch
RR A
ACALL DELAY
SJMP AGAIN
NXT:RL A
ACALL DELAY
SJMP AGAIN
/////////////////////////////////////////////////////////////////////////////////////////////
DELAY:
MOV R1,#01H
H3:MOV R2,#0FFH
H2:MOV R3,#0FFH
H1:DJNZ R3,H1
DJNZ R2,H2
DJNZ R1,H3
RET
msg:
db 08h,04h,02h,01h,0
END
CLICK HERE TO SEE CIRCUIT DIAGRAM
ORG 0000H
MOV P2,#00H ;initialize as op port
/*
////////////////////////////////////////METHOD-2 HALF STEPPING//////////////////////////////////////////
exit:
mov dptr,#msg
rpt:clr a
movc a,@a+dptr
jz exit
inc dptr
mov p2,a
acall delay
sjmp rpt */
/////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////METHOD-1//////////////////////////////////////////
MOV A,#66H
AGAIN:MOV P2,A
JNB P1.0,NXT ;check status of switch
RR A
ACALL DELAY
SJMP AGAIN
NXT:RL A
ACALL DELAY
SJMP AGAIN
/////////////////////////////////////////////////////////////////////////////////////////////
DELAY:
MOV R1,#01H
H3:MOV R2,#0FFH
H2:MOV R3,#0FFH
H1:DJNZ R3,H1
DJNZ R2,H2
DJNZ R1,H3
RET
msg:
db 08h,04h,02h,01h,0
END
CLICK HERE TO SEE CIRCUIT DIAGRAM