Stepper motor. Step & direction!

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Stepper motor. Step & direction!

Post 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
Attachments
18F26K22_TWO_STEPPERSConvert 876.fcfx
(21.94 KiB) Downloaded 228 times
Stepper Puls Mega.fcfx
(7.83 KiB) Downloaded 232 times
Stepper Puls 876.fcfx
(8.34 KiB) Downloaded 238 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Stepper motor. Step & direction!

Post 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);
    }
}

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Stepper motor. Step & direction!

Post 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.

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: Stepper motor. Step & direction!

Post 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.

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: Stepper motor. Step & direction!

Post 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.

Post Reply