Hi rstofer,
Thanks. I managed to get work it. Actually, 360 degree divided by 7.5 degree is 48.It means that we have to apply 48 pulses to get one revolution. I wrote code like below for Clockwise and Counter Clock Wise.
#define TOTAL_STEPS 4
#define STEP_MASK (TOTAL_STEPS - 1)
static uint8_t Cw_Steps[TOTAL_STEPS] = {0x08,0x04,0x02,0x01};
static uint8_t CCw_Steps[TOTAL_STEPS] = {0x01,0x02,0x04,0x08};
uint8_t CW_Step = 0, CCW_Step = 0;
/*--------------------STEP CLCOKWISE--------------------------------*/
void SingleStep_ClockWise(void)
{
LATD &= 0xF0;
LATD |= Cw_Steps[CW_Step & STEP_MASK];
CW_Step++;
Start_Timer();
while(!One_Step_Complete);
Stop_Timer();
}
/*--------------------STEP CLCOKWISE--------------------------------*/
void SingleStep_CClockWise(void)
{
LATD &= 0xF0;
LATD |= CCw_Steps[CCW_Step & STEP_MASK];
CCW_Step++;
Start_Timer();
while(!One_Step_Complete);
Stop_Timer();
}
Set timer to 333ms to get rpm of 4.
Thanks,
Muthu