we have a program and we are operating three stepper motors·independently.· Each stepper motor has to be turned ON at different times, for example stepper motor 1 turns every·8 hours, stepper motor 2 turns every 6 hours, and stepper 3 turns ever·4 hours.· The reason we are having a problem is because these times are variables inputted by the user using the keypad.· Our initial plan was to use the PAUSE command, but realized that it would affect the other two stepper motors.
Here's an idea that you may be able to apply: You do only one PAUSE,·at a small increment that can drive the others.·By·using the modulus operator·you can update each independently.
Main: · DO ··· PAUSE 100 ····motor1 = motor1·+ 1·// M1Count······ ' update motor "clock" ····IF (motor1 = 0) THEN················ ' update motor on roll-over ······' update motor 1 ··· ENDIF ····motor2 = motor2 + 1 // M2Count ····IF (motor2 = 0) THEN ······' update motor·2 ··· ENDIF ··· motor3 = motor3 + 1·// M3Count ····IF (motor3 = 0) THEN ······' update motor·3 ··· ENDIF · LOOP
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ Jon Williams Applications Engineer, Parallax
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Main:
· DO
··· PAUSE 100
····motor1 = motor1·+ 1·// M1Count······ ' update motor "clock"
····IF (motor1 = 0) THEN················ ' update motor on roll-over
······' update motor 1
··· ENDIF
····motor2 = motor2 + 1 // M2Count
····IF (motor2 = 0) THEN
······' update motor·2
··· ENDIF
··· motor3 = motor3 + 1·// M3Count
····IF (motor3 = 0) THEN
······' update motor·3
··· ENDIF
· LOOP
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax