gne_577
Junior Member level 3
hello
am using l297-l298 stepper drive to rotate the bipolar stepper motor along with PIC18f85j11 micro-controller. It gives problem that whenever i set up a direction for rotation, it gives malfunctioning as in result. sometime the motor rotated in clockwise or in anticlockwise.
but in some cases if i continuously rotate the motor, it will rotated in same direction on other hand as i rotated in the steps it will start giving this error.
The programming code is written below:
//20mhz external oscillator used
void DelayMS(unsigned int itime) // Function by Passing Parameter
{
unsigned int i, j;
for(i=0;i<itime;i++)
for(j=0;j<5;j++);
}
void main()
{
STITCH_CLK_DIR=STITCH_FR_DIR=STITCH_EN_DIR=0; //make these pins are output
DelayMS(250) ;
STITCH_FR=1; // make the motor direction in reverse
DelayMS(100) ;
STITCH_EN=0; // make the l297 enable pin on
DelayMS(100) ;
while(i<250) //250 clocks given to stepper motor
{
STITCH_CLK=0; // clock pin on
DelayMS(2);
STITCH_CLK=1; // clock pin off
DelayMS(1);
i++;
DelayMS(1);
}
STITCH_EN=1; // make the l297 enable pin on
DelayMS(250) ;
while(1);
}
am using l297-l298 stepper drive to rotate the bipolar stepper motor along with PIC18f85j11 micro-controller. It gives problem that whenever i set up a direction for rotation, it gives malfunctioning as in result. sometime the motor rotated in clockwise or in anticlockwise.
but in some cases if i continuously rotate the motor, it will rotated in same direction on other hand as i rotated in the steps it will start giving this error.
The programming code is written below:
//20mhz external oscillator used
void DelayMS(unsigned int itime) // Function by Passing Parameter
{
unsigned int i, j;
for(i=0;i<itime;i++)
for(j=0;j<5;j++);
}
void main()
{
STITCH_CLK_DIR=STITCH_FR_DIR=STITCH_EN_DIR=0; //make these pins are output
DelayMS(250) ;
STITCH_FR=1; // make the motor direction in reverse
DelayMS(100) ;
STITCH_EN=0; // make the l297 enable pin on
DelayMS(100) ;
while(i<250) //250 clocks given to stepper motor
{
STITCH_CLK=0; // clock pin on
DelayMS(2);
STITCH_CLK=1; // clock pin off
DelayMS(1);
i++;
DelayMS(1);
}
STITCH_EN=1; // make the l297 enable pin on
DelayMS(250) ;
while(1);
}