
May 14th, 2011, 01:04 PM
|
|
Registered User
|
|
Join Date: Aug 2010
Posts: 3
Time spent in forums: 1 h 25 m 51 sec
Reputation Power: 0
|
|
Stepper code help
hiii i have some stepper code here but i am confusing the if (Motor_Steps--) statement so help me for understanding this code
BOOL Pulse_Motor(void)
{
if(State)
{
GPIO_PORTE_DATA_R = MOTOR_STEP_OUT;
State = 0;
}
else
{
GPIO_PORTE_DATA_R = 0;
State = 1;
Step_Table_Index++;
}
if (Motor_Steps--)
{
// Set next match value
TIMER0_MATCHR_R = TIMER0_TC_R+Motor_deltaTimer_Value;
}
else
{
Motor_Stop();
}
return 0;..................................is it right?
}
if any wrg then suggest plz...
|