stepper code help

Discussion in 'Embedded Systems and Microcontrollers' started by embed_v, May 14, 2011.

  1. embed_v

    Thread Starter New Member

    Aug 30, 2010
    24
    0
    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...
     
Loading...