Stepper problems with speed.

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

Moderator: Benj

Post Reply
astro1234
Posts: 50
Joined: Mon Apr 10, 2017 12:53 pm
Has thanked: 39 times
Been thanked: 13 times
Contact:

Stepper problems with speed.

Post by astro1234 »

Hi.
I am having problems controlling two stepper motors with different
Speeds, using a pic 18F26K22 chip.
I am using two timers, so that I can control the two stepper motors speeds, but although
The timers show different speeds, the steppers are running both at the same speed.
Change one timer, and this effects the other stepper.
Am I using the timers’ correctly? (This is my first time using timers).
Can the chip operate ok with the two timers ? , or do I need a different pic chip.
Regards Roy.

PS. although this works in the simulation, it does not run right on the test bench .
Flow code V8.2.1.14
Win 10 pro.
Attachments
18F26K22_TWO_STEPPERS _TIMER.fcfx
(29.78 KiB) Downloaded 145 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 problems with speed.

Post by Benj »

Hello,

Having multiple independent timers on a single device should be no problem.

I might start by trying to reduce the code inside the interrupt routines to allow the timers to fire without potentially colliding with each other. For example timer 2 fires and starts being serviced. By the time you leave the macro timer 4 has fired and you start servicing that one, then when you leave timer 4 timer 2 has fired again etc. Changing the interrupt rate wouldn't have much effect in this case.

Try this and see if it's any better.
18F26K22_TWO_STEPPERS _TIMER.fcfx
(31.18 KiB) Downloaded 174 times
You could also try reducing the timer interrupt frequencies and see if this helps things, in which case you might need to use a faster device e.g. a 16-bit PIC running at 140MHz.

Post Reply