void void_GenerateStepInput() // function to generate step input { XTimerPeriod = 400; void_EnableStepperMotor(XAxis);//Enable stepper motor along X Axis Timer_B_outputPWMParam GenerateStepInputXParam = {0};//Setting TA2 parameters for step input generation. GenerateStepInputXParam.clockSource = TIMER_B_CLOCKSOURCE_SMCLK; GenerateStepInputXParam.clockSourceDivider = TIMER_B_CLOCKSOURCE_DIVIDER_1; GenerateStepInputXParam.timerPeriod = XTimerPeriod; GenerateStepInputXParam.compareRegister = TIMER_B_CAPTURECOMPARE_REGISTER_2; GenerateStepInputXParam.compareOutputMode = TIMER_B_OUTPUTMODE_TOGGLE; GenerateStepInputXParam.dutyCycle = XTimerPeriod/2; Timer_B_outputPWM(TIMER_B0_BASE,&GenerateStepInputXParam); //step input generation } void TIMER0_B1_SpecificDistance_ISR(void) { if(++TimerCountX >= NumberofSteps) { void_TerminateStepInput(); Timer_B_disableCaptureCompareInterrupt(TIMER_B0_BASE,TIMER_B_CAPTURECOMPARE_REGISTER_2); TimerCountX = 0; } Timer_B_clearCaptureCompareInterrupt(TIMER_B0_BASE,TIMER_A_CAPTURECOMPARE_REGISTER_2); }