NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

access values from sequences during execution

Hello,
I am trying to control multiple stepper motors simultaneously in labview.
I am not using any NI hardware, so all control must come in the form of digital writes to a third party board. what I have done is to create a sequence structure inside a case structure for each stepper motor. The actual writing to the 3rd party board is outside these parallel case/sequence structures, and therein seems to lie the problem. Inside each sequence structure I give a digital pulse 0-1-0; the problem is that the sequence structure does not seem to be relaying this information during its execution. This means that all the 3rd party hardware sees is the 0 part of the pulse (i.e. the last value seen in the sequence structure). Is there any way to allow the sequence structure to output the data values inside of it DURING its execution.
Any help would be appreciated.
Thanks
JOe P
0 Kudos
Message 1 of 4
(3,363 Views)
Hi Thoj,

LabVIEW follows a DataFlow programming model. This means that any node executes only when it has values for all its inputs. Since you have a structure inside a case structure, any information would leave the case structure only when everything inside the case structure has finished executing. To get around this problem, you can create a Local variable(does not follow the DataFlow paradigm) for the digital pulse value. The value of the local variable would get updated as soon as you write to it from within the structure.

Hope this helps.

Ankita
0 Kudos
Message 2 of 4
(3,332 Views)
To all who have helped,
thanks for your reply. In my program, what i have is a 3 long sequence structure, inside of which two of the same local variables appear (each on a different sequence page. the sequence structure is surrounded by a case structure, which is in turn surrounded by another case structure; so in total, there is a sequence structure surrounded by two case structures. I am having the problem of getting the local variables in the sequnce structure to read. The wait time in the two structure boxes that contain the two concerned local variables is between 1 and 10 ms, so i don't see this as the problem. But the problem is that i cannot get the local vars to read (it doesn't read at all if I don't use a property node outside the seq./case/case structure and only 1 out of about 100 times if i use the property node). I have tried putting the actual indicator the local vars. refer to both inside and outside the sequence, but this doesn't seem to make a difference either. I think maybe my problem lies in my programming style, but I am not sure. I will attach a copy of the progarm, so If anyone wants to take a look, they can (step 1, step 2, etc are the problematic local vars). Thanks for all the help so far,
JOe
0 Kudos
Message 3 of 4
(3,322 Views)
Hi,

Perhaps I should have mentioned this in my last post. With Local variables, you might run into "race conditions". This means that you might overwrite some data in the local variable before the previous data has been read. This is a very common problem so it is a good practice to minimise the use of local variables by using wires as much as possible. The other alternatives include but are not limited to using Queues and Notifiers.

About your specific code, it is hard to understand what you are doing since it is not apparent how you want the data to flow. I would suggest posting a small piece of code(without the subVIs so the run arrow is not broken)that demonstrates the behaviour. Someone might then try to help you out. Also try to minimise the use of Local variables (there is no need for local variables for On 1, On 2, Direction 1, Direction 2 etc...you can simply use the actual controls and wires to access the value at different places within the sequence frame).

Ankita
0 Kudos
Message 4 of 4
(3,304 Views)