Apr 8, 2014

BIPOLAR STEPPER MOTOR INTERFACING WITH PIC

Here i am using bipolar stepper motor. I have used 4 pins in the PIC16f877a  (RB7, RB6, RB5, RB4)  to energize the coils via l293d H driver .
Note: Use  H-Driver greater than 1 Ampere for long time.

Program

#include<pic.h>
#define _XTAL_FREQ 16000000
__CONFIG(0X3F7A);
void main()
{
TRISB=0X0;  
RB7=1; RB6=0; RB5=0; RB4=0; //1
__delay_ms(200);
PORTB=0X0;

RB7=0; RB6=0; RB5=1; RB4=0;
__delay_ms(200);
PORTB=0X0;

RB7=0; RB6=1; RB5=0; RB4=0;
__delay_ms(200);
PORTB=0X0;

RB7=0; RB6=0; RB5=0; RB4=1;
__delay_ms(200);
PORTB=0X0;

while(1);
}