Tut 9 : Stepper motor

A stepper motor is an electromechanical device which converts electrical pulses into discrete mechanical movements. The shaft or spindle of a stepper motor rotates in discrete step increments when electrical command pulses are applied to it in the proper sequence. The motors rotation has several direct relationships to these applied input pulses. The sequence of the applied pulses is directly related to the direction of motor shafts rotation. The speed of the motor shafts rotation is directly related to the frequency of the input pulses and the length of rotation is directly related to the number of input pulses applied. 

A stepper motor rotates with a fixed step angle, with a basic step angle of 0.9° and 1.8° for each clock cycle. A system configuration for high accuracy positioning is shown below. The rotation angle and speed of the stepper motor can be controlled with precise accuracy by using pulse signals from the controller. 
A stepper motor is used to achieve precise positioning via digital control. The motor operates by accurately synchronizing with the pulse signal output from the controller to the driver. Stepper motors, with their ability to produce high torque at a low speed while minimizing vibration, are ideal for applications requiring quick positioning over a short distance.

PBP Program
'Program to run a stepper motor forward and reverse

DEFINE OSC 20                             ' using 20MHz clock oscillator
@ device hs_osc
 
TRISB=0 
i VAR BYTE 
loop:
For i=0 TO 50                                          'forward direction
PORTB=101000
PAUSE 100
PORTB=011000
PAUSE 100
PORTB=010100
PAUSE 100
PORTB=100100
PAUSE 100
Next i
 
For i=0 TO 50                                          'reverse direction
PORTB=100100
PAUSE 100
PORTB=010100
PAUSE 100
PORTB=011000
PAUSE 100
PORTB=101000
PAUSE 100
Next i

Goto loop
End



No comments:

Post a Comment