08-23-2013 11:35 AM
Hello,
I am using an 8-channel DO fieldpoint to control 4 stepper motors, which are triggered by inputting 5V at certain intervals. I am creating a subVI first, so I can eventually use 1 such subVI to control 1 motor in the while loop of my mainVI. Im doing the subVI as follows:
Step 1: initialize a 1-D array (value=0 and length=8);
Step 2: for the channel connected with the motor, replace the its corresponding value by 1;
Step 3: write the output array to the field point;
Step 4: replace the '1' (in step 2) back to '0'.
Now I realize that this subVI might work for 1 motor, but it might not work if I use several subVIs in my mainVI for multiple motor control (since every time each subVI sends '1' to its corresponding channel, but '0' to others, which overwirte the other subVIs.
So I think what I really need is a subVI that can control ONE channel independently without interfering other channels' values..Any solution?
08-23-2013 11:59 AM
Now I realize that this subVI might work for 1 motor, but it might not work if I use several subVIs in my mainVI for multiple motor control (since every time each subVI sends '1' to its corresponding channel, but '0' to others, which overwirte the other subVIs.
You overwrite the value back to 0 anyway. So why does this concern you?
Just have an input to the subvi to indicate which elements need to be triggered, generate the array, send, and reset.
08-23-2013 12:18 PM
Hello pjr,
Thanks for response..My concern is I overwrite all 8 channles to '0' every loop. But what I want is to overwrite only 1 channel to '0', so that the other channels can run independently.
The following example (using the exact same subVI in my previous post) shows the problem: It is supposed to control 2 motors independently, but both loops (stepper motor 1) reset the 8-channel back to '0,0,0,0,0,0,0,0' array upon completeness. Since two motors are connected to two of the 8 channles on the same fieldpoint, each reset will interfer the other motor's operation, which is not I want....![]()
08-23-2013 01:03 PM
Why not simply set multiple indices of the array in a single loop? Or are the timings for each motor that different? I'm trying to understand exactly why it is necessary to have the 8 independent loops.
I've not used Field Points before so forgive me if these questions are misleading/wrong.
08-23-2013 01:12 PM
Step 1: initialize a 1-D array (value=0 and length=8);
Step 3: write the output array to the field point;
If you can write the array to the FieldPoint can you not read the array from FieldPoint ?
So instead of initializing your 1D array (to value=0 and length=8) read the current state instead.
If done properly it should preserve the motors already running.
I would fix the numerous issues you have first though (even if it does not look like it).
1> No wait in the loops
2> Code which does not change between iterations move outside of the loops
3> The above fix will likely cause race conditions because of the way it is structured so changing architectures is recommended.
08-23-2013 08:19 PM
Instead of addressing all 8 channels with the Fieldpoint I/O and writing an array, I don't you just address the one channel you actually want to change and write a boolean. (You did say you are using a digital output module, so a boolean value makes more sense.)