Stepp Motor

 

Unipolar (up):

Bipolar stepper motors(Down):

The bipolar stepper motor usually has four wires coming out of it. Unlike unipolar steppers, bipolar steppers have no common center connection. They have two independent sets of coils instead. You can distinguish them from unipolar steppers by measuring the resistance between the wires.


 

code:

start:
High PORTB.0

' set variables:
x VAR BYTE
steps VAR WORD
stepArray VAR BYTE(4)
clear

TRISD = %11110000
PORTD = 255
input portb.4
Pause 1000

stepArray[0] = %00001010
stepArray[1] = %00000110
stepArray[2] =%00000101
stepArray[3] = %00001001


main:
if portb.4 = 1 then
steps = steps + 1
else
steps = steps - 1
endif

portD = stepArray[steps //4]
pause 2

GoTo main