burpal
Newbie level 1
hello all, i wrote a code for rotating a stepper motor. The code seems to work fine as i connected 4 LED's to test the stepping sequence.
I am using the ULN 2003 to drive the stepper motor(M35SP). When i switch on the power source(24V), my microcontroller stops the stepping sequence and gets stuck at the first value, in my program, 0x01...
Please help!!
Here is the source code i am using...
I am using the ULN 2003 to drive the stepper motor(M35SP). When i switch on the power source(24V), my microcontroller stops the stepping sequence and gets stuck at the first value, in my program, 0x01...
Please help!!
Here is the source code i am using...
Code:
#include<p18cxxx.h>
#include <delays.h>
void main()
{
ADCON1 = 0b00001111;
TRISA=0x00;
PORTA=0x00;
while(1)
{
PORTA=0x01;
Delay1KTCYx(240);
Delay1KTCYx(240);
Delay1KTCYx(240);
Delay1KTCYx(240);
Delay1KTCYx(240);
PORTA=0x02;
Delay1KTCYx(240);
Delay1KTCYx(240);
Delay1KTCYx(240);
Delay1KTCYx(240);
Delay1KTCYx(240);
PORTA=0x04;
Delay1KTCYx(240);
Delay1KTCYx(240);
Delay1KTCYx(240);
Delay1KTCYx(240);
Delay1KTCYx(240);
PORTA=0x08;
Delay1KTCYx(240);
Delay1KTCYx(240);
Delay1KTCYx(240);
Delay1KTCYx(240);
Delay1KTCYx(240);
}
}