LabVIEW

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
0 Kudos
Message 1 of 6
(2,906 Views)
If you need to get the intermediate values, before the end of the sequence, you can use local variables (right click on the terminal, then Create> Local variable...). There are other solutions, such as using a property node, to read the variable value (right click on the terminal, then Create>Prperty node, then right click on the property node, and select "value"...), or using a different program architecture.

CC
Chilly Charly    (aka CC)
0 Kudos
Message 2 of 6
(2,895 Views)
Could you use a queue architecture to do this?? Have a loop that writes data into a queue. Part of this data could contain the motor number to control and the data value. Another loop does nothing but read data out of the queue and write the command to the appropriate motor.
0 Kudos
Message 3 of 6
(2,889 Views)
A queue could be used for this. A queue would ensure that no command is missed. (one of the benefits of a queue). Without a queue...you will want to make sure nothing is going to hang in one of your loops otherwise your commands may be lost.

What would I do?....depends.

Lots of processing...time not important but sequence is...queue.
Less processing...time more important than missing a step or two....local var


-Brett
0 Kudos
Message 4 of 6
(2,867 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 5 of 6
(2,857 Views)
Joe,

I highly suggest running your program with highlight execution enabled. With this, you will be able to watch the execution of your code from the block diagram. With as many embedded structures as you have, you could easily be missing a step that is locking out a routine or output.

Also...for future reference...The best way to move data from frame to frame in a sequence structure is to use a sequence local. Create one of these by right-clicking on the border and select "add sequence local". Think of this as a tunnel for your data to the back pages.

-Brett
0 Kudos
Message 6 of 6
(2,842 Views)