Page 1 of 1

Stepper motor. Step & direction!

Posted: Tue Jul 23, 2019 9:27 pm
by jgu1
Hi Ben Roy!

Please have a look here: viewtopic.php?f=76&t=21359 It was not possible for me to continue in the tread?

As far I understanding concerning this stepper component, is that it is possible to control the motor directly via fet transistor or Step & Direction.
I imagine that, the Step & Direction mode is to control a moduledriver for the steppermotor. Could be one like this : https://www.ebay.com/itm/5PCS-A4988-Ste ... Swl9BWKyv1
I have tested Roy´s program, and made one by myself. Converted to an Aduino and a Pic16f876. But it doesn´t get any puls out?.

I suppose that the I should get a frequency output on the dedicated pin depending on the delay in the loop? I don´t get any. Have I misunderstod something, by using this? :wink:

Thank´s in advance

Jorgen

Re: Stepper motor. Step & direction!

Posted: Wed Jul 24, 2019 10:42 am
by Benj
Hi Jorgen,

I've had a look at the C code generated by the component and it looks ok to me. You can maybe take the enable icon out of the loop and place before but I don't think this would cause any issues.
As far I understanding concerning this stepper component, is that it is possible to control the motor directly via fet transistor or Step & Direction.
I imagine that, the Step & Direction mode is to control a moduledriver for the steppermotor. Could be one like this
Yes you're correct here the Step and Direction mode is used with a stepper motor driver IC or module.
I suppose that the I should get a frequency output on the dedicated pin depending on the delay in the loop? I don´t get any. Have I misunderstod something, by using this? :wink:
Currently in the code the output pulse is only high for 1us. Could this be the problem and maybe we are trying to pulse the output too fast?

Here is the simplified component code for the IncrementStep function, I could make the delay adjustable via a property if this is the cause of the problem.

Code: Select all

void IncrementStep()
{
    if (ENABLED)
    {
            // DirectionPin = 1
            SET_PORT_PIN(A, 1, 1);

            // StepPin = 1
            SET_PORT_PIN(B, 0, 1);

            DELAY_US(1);

            // StepPin = 0
            SET_PORT_PIN(B, 0, 0);
    }
}

Re: Stepper motor. Step & direction!

Posted: Wed Jul 24, 2019 12:15 pm
by Benj
The A4988 driver IC seems to have a minimum pulse width of 1uS so this should be ok but is maybe a bit close for comfort.

I'll make the delay into a property so you can tweak the value if needed.

Edit, this has now been added and pushed to the update system.

Re: Stepper motor. Step & direction!

Posted: Wed Jul 24, 2019 3:32 pm
by jgu1
You are amazing. :D
Again thank`s Ben. I make an Update later today, and a test, you hear. I did not know that the puls is so short, honestly I was only checking the output with a scoope, so my timing and trig was maybe to short. :roll:

Br.

Jorgen.

Re: Stepper motor. Step & direction!

Posted: Wed Jul 24, 2019 9:07 pm
by jgu1
Hi Ben!

Again succes from you :wink: :wink:

Working perfect. Very nice detail to be able to change the "Ontime" Working. Thanks.

Br Jorgen.