Wednesday, April 13, 2016

Stepper Motor Interface using 89C51

Introduction
Stepper motors are commonly used in accurate motion control. They allow to control any motion with high precision by counting the number of steps applied to the motor.Most of systems controlling stepper motors are embedded systems such as printer, scanner or floppy disk drive. This application note describes how to drive a unipolar stepper motor with the Programmable Counter Array of an Atmel 89C51microcontroller.

Connection Diagram:
Stepper Motor Interface with 89C51

Identification of Stepper Motor:

There are several types of stepper motors, these cannot be driven in the same way. In this application note, we have chosen to drive a unipolar stepper motor (see Figure 2). For more information you will find schemes to identify the other types of stepper motors.

Figure 2. Unipolar Stepper Motors Coils
Unipolar Stepper Motor Unipolar stepper motors are characterised by their center-tapped windings.


Figure 3. Bipolar Stepper Motor Coils
Bipolar Stepper Motor Bipolar stepper motors are designed with separate coils.


Driving Unipolar Stepper Motors
There are three ways to drive uni polar stepper motors (one phase on, two phase on or half step), each one has some advantages and disadvantages.





In one phase mode, each successive coil is energized in turn. One phase mode produces smooth rotations and the lowest power comsumption of the three modes. Steps are applied in order from one to four. After step four, the sequence is repeated from step one. Applying steps from one to four makes the motor run clockwise, reversing the order of step from four to one will make the motor run counter-clockwise.


In two phase mode, successive pairs of adjacent coils are energised in turn, motion is not as smooth as in one phase mode, power comsumption is more important but it produces greater torque. As in one phase mode, applying the steps in order makes the stepper motor run clockwise and reversing order makes it turn 
counter-clockwise.


Programming Stepper Motor:


INCLUDE 89C51.MC
;-----------------------STEPPER MOTOR--------------------------
;Motor connections to microcontroller
C1  EQU P0.0  ; coil 1
C2   EQU P0.1  ; coil 2
C3  EQU  P0.2  ; coil 3
C4  EQU P0.3  ; coil 4
DATA  EQU P0
;----------------------------------------------------------
(0000H):
 JMP on_reset
;----------------------------------------------------------
(00FFH):
on_reset: 
  CLR C1
  CLR C2
  CLR C3
  CLR C4
  MOV A,#88H
ENDLESS: 
  RR A
  MOV DATA,A
  CALL delay
  JMP ENDLESS 
;----------------------------------------------------------
delay:
  MOV R7,#FFH
again: NOP
  DJNZ R7, again
RET

No comments:

Post a Comment