09-19-2018 11:48 AM
Target:
1. Run and Stop 3 Different stepper motors independently and continuously
2. Control the speed of each motor in live time.
Problem:
Having trouble changing the speed of the Motor 2 (Funnel Motor) and when we turn any of the three stops all the motor gets stopped. But we need to stop each motor independently.
Motor 1(Collector Motor) can change speed in live time but can not run continuously.
Can anyone please help us to fix these problems?
09-19-2018 03:58 PM
In the upper loop you have control of the motor in an Event Structure. You are only sending commands to the stepper motor is the OK button is pressed or if the RPM value changes. You do nothing in the Timeout case and after that all you do is check the status of the stepper motor. None of your motor control should be inside cases of the event structure.
You have no timing control in the loop for your second motor. That loop is running as fast as it can.
As for stopping all of your motors, you close the motor controller when any loop is completed. That will stop all of the motors. You should only close the motors once all three loops have been stopped.
09-20-2018 03:27 PM
Thank you very much for your kind reply.
If I delete the event structure the motor does not move smoothly. I know I should only close the motors once all three loops have been stopped. But as I am very new to work in Labview, I really could not figure it out how to modify it in Labview. I need to run the second motor(Funnel) very fast and continuously unless we press stop. So how to implement time control here?
09-20-2018 03:33 PM - edited 09-20-2018 03:54 PM
On the second loop you need to run that fast place a Wait(ms) with a 0 wired to it. THat allows the scheduler to see if anything else needs to run. WIth no timing at all in it you could starve the CPU. Though now that I think of it the calls to the stepper motor probably have VISA calls in them and those will allow the scheduler to see if anything needs to run.
As for the the top loop you would need to show how you changed it when you removed the event structure. You would still need to provide some type of timing control in that loop.
Another thought is that all of your loops are using a single serial connection to the device and with communication in parallel tasks you could get some strange behavior since you have no control of which loop is writing what command at what time.
EDIT: The more I look at the Arduino VIs the less I think you should be running this in three separate loops. If I am not mistaken you would simply need a single loop which will control when you start/stop the motors and how many steps you will run the motor. You can set the step count very high and the Arduino will continue to step that motor. I don't think you want your LabVIEW code actually stepping the motors, let the Arduino handle that. Your LabVIEW code should simply control the Arduino.
09-20-2018 03:46 PM
Thank you very much for your reply sir. I modified as per your suggestion. I want to change the speed of the second motor (funnel) with the dial but I am really unable to change that.
09-20-2018 04:02 PM
I want to run each motor continuously unless I press stop. But each motor stops automatically after few minutes
09-20-2018 04:19 PM
Wiring an Infinite for the number of steps will not work. The step count is a I16, so the maximum number of steps that will run will be 32568. You will need to load more steps for the more to run at periodic times. You could simply continue to write a large number of steps on a periodic basis. This will overwrite a previous command however you want it to run continuously so it shouldn't matter. If it does, you can call the "Stepper to Go" VI to see how many steps are remaining on that motor. Ultimately, all of your code for the Arduino needs to be in a single loop.
09-21-2018 11:16 AM
Thank you very much for your reply sir.