Re: Machine Automation Program - need peer feedback...
Thanks again Jerson,
I thought that's what you meant by a stepper coil table... but I have no need for that.
The steps that I refer to in the 'BRANCH' command, are process steps in my machine... such as the following example: Step_1... raise sealing bar, Step_2... turn on suction cup vacuum, Step_3... turn Y stepper motor 1200 pulses CCW, Step_4... turn X stepper motor 3400 steps CW... etc. Keep in mind that the pulses on Step_3 are sent one pulse at a time per loop.
I've re-written some code to illustrate. See below: (this differs from my original posted code)
In step 2, I set variable i to the value 100 and increment the step to LStep_3. Then I loop back to MAIN.
When I next BRANCH, I will wind up at LStep_4 and send one pulse to the the stepper controller (off board).
Since the WHILE statement is true, the program decrements i by one and returns (to MAIN). It will continue to branch to
LStep_4 sending one pulse at a time until the WHILE statement is no longer true, then set left_side_step = 5 and return to MAIN.
Note: I haven't shown any acceleration or deceleration in this code. That bit is complicated. :-P
Code:
LStep_2:
'do these things
left_side_step = 3
i = 100 'set variable i for the number of pulses in step
Return 'three. (placed here for readability)
LStep_3:
pulsout portb.7,4 'send out one pulse to stepper controller
while i <> 0 'while statement is true, decrement i by one and
i = i -1 'return to main (loop) Continue sending one pulse
return 'each time the program loops here until the 'while'
wend 'statement is false... then increment 'left_side_step
left_side_step = 4 'to LStep_4
return
Thank you for taking the time to look at this with me!
Ross
Never enough knowledge to be called intelligent but just enough knowledge to be considered dangerous!
I like that! :-)
Bookmarks