embed_v
Junior Member level 1
hiii i have some stepper code here but i am confusing the if (Motor_Steps--) statement so help me for understanding this code
if any wrg then suggest plz...
Reply With Quote
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...
Reply With Quote
Last edited by a moderator: