Quote Originally Posted by wdmagic View Post
Theres alot of jumping around, half your code is gosubs and returns. its confusing me. and then theres all these steps, i'm wondering if your trying to do a texas 2 step dance.. is there a reason your using loops to control speed? you could do the same thing using an adjustable pause at the end of your gosubs in main.
The point of this code example is to show how I am accomplishing multiple movements at the same time. Quite frankly I don't know another way and would like to know if others are doing it differently. With this code I can control multiple steppers at the same time. (or at least they will all look like they are moving at the same time).

I am constantly looping through Main: On each loop I update inputs and outputs. I also operate things going on on the left and right sides of the machine. The left side could be on step seven, the right could be on step two. With the way I have organized it, it is very easy to add steps and move from one to another by simply adding additions to the branch statements.

Conditions are built in to the "Left_Side_Operation" and "Right_Side_Operation" routines. They allow or disallow access to the Branch statements and subsequently to the "steps".

One important objective was to maintain a high loop speed. When it came time to send pulses to stepper motors I didn't want them to crawl along.

Thank you for your feedback.

Ross