I know this question has probably been asked and answered before, but after searching/reading in the forums, I'm still confused.
So I would like my VI to effectively move a stage a given distance with incremental sizes with pauses of between each step.
Effectively: "Go To" _____ With X step size: causes the VI to: move, pause, move pause...etc until the stage has reached the end.
To accomplish this I set up a for loop inside a case structure, and took the "Go To" / by Step Size to get the number of iterations the loop aught to run (labview apparently rounds the double result to the integer form), and then I send the "Step Size" to the MoveAbs VI.
I am not sure if my logic is terribly off, but when I perform the command, the stage at least moves, but not to the correct location.When I inserted probes, they list the correct values being sent to the subvi's etc...
Does anyone have an idea why this would not work? Any better ideas to institute this type of motion?
OK having the for loop inside the event was a bad idea on the timed event. I added a state machine structure and cleand up your code. I did not have a chance to get it all done as I have to go home. This should be enough to get someone to help. I will try to help with questions tomorrow.
You should keep your questions about this code here instead of sending private messages that way others can learn for our discussion.
I was having some problems with the code you sent back--specifically about getting multiple commands to function from the control panel. I am attaching it with questions so that others can benefit from this too--other people feel free to weigh in!
As always, thanks for your help!
Here is the answers. Very good questions. It shows that you do mostly understand what we are doing.
I've got another question for you--I've been working on the program and I think I finally understand the basic outline. I've been trying to add other subvi's to increase functionality and I came across a problem:
The error list says that the selector values of the case structure are not unique--which is true of the program I am sending you. So naturally I deleted the extra "VI INI" which was tagged onto the default case. However doing so caused my program to crash--or more accurately cycle in an infinite loop. The program initializes over and over again. The "INI VI" sends another "INI VI" to the array and gets stuck.
I am not quite sure what is wrong, because when I looked at the original program you had sent to me, and earlier versions I had edited, I noticed that they have the same code within the "INI VI" case...in addition, now when I open previous programs--that were functioning perfectly well before--I get the same error message complaining about "not unique selector values". I honestly don't recall ever adding "INI VI" to the default case...
I am attaching the program and was wondering your thoughts, especially given the retrospective error...
Let me know if I was unclear in explaining the problem etc...and thanks again for your help. Others' input welcomed too!
I've noticed that the VI INI is looping around itself, but I am not sure why that's the case--because the original code you sent, and subsequent code I wrote, was the same and was functional. As of now the program begins with a VI INI which then calls itself. Shouldn't VI INI call a different case? I would prefer it to call the first one--but that is currently set as the default case--which is never being reached and cannot be called because it is the default case. Could I call the VI INI case and have it return nothing to the array?