LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to write to indicator cluster in a state machine

Hi,

 

I have been making a few posts lately about state machines. I am trying to convert an existing program into a program using the state machine architecture, but I am not sure how to write to the indicators on the front panel. I put all of the indicators into a cluster so I could just pass the cluster through, but then I realized it's read-only so I can't exactly pass it through. Is there an easy way to do this? 

0 Kudos
Message 1 of 12
(4,180 Views)

What do you mean by read-only?  You can use the Bundle by Name and Unbundle byName primitives to read and write to a cluster wire.  I use clusters for this exact purpose in most of my state machines.

 

Please post your code or a small example showing the problem you are having.

 

Lynn

0 Kudos
Message 2 of 12
(4,177 Views)

I tried that, but you need an input cluster for those bundle functions, and an indicator cluster is an output cluster, right? 

0 Kudos
Message 3 of 12
(4,173 Views)
You need to keep the cluster data in a shift register and manipulate the SR data in each state as required.
0 Kudos
Message 4 of 12
(4,147 Views)

The wire is the variable.  An indicator is a display device which is supplied with data by a wire.  A control is an input device which can supply data to a wire.  Every wire must have a source of data - a control, a constant, or the output of some node which has the correct datatype (such as Unbundle).  Every wire must connect to a sink of data - an indicator or the input to a node which accepts its datatype.

 

You can connect any cluster type wire to the cluster terminal of a Bundle by Name or Unbundle by Name.

 

Typically I create a typedef of the indicators cluster.  I put a constant on the diagram at the left as the source for the wire.*  I use the Bundle by Name and Unbundle by Name primitives wherever I need access to the data.  I usually use individual indicators on the front panel for displaying the data.  This way the layout of the FP is not constrained by the configuration of the cluster.  Often the cluster does not appear as a control or indicator at all in the main VI.  They appear often in subVIs which need the data, but the panels of those subVIs are not presented to the user.

 

* If the cluster constant occupies too much diagram space, it can be put into a VI which has an icon much smaller than the constant.  Set the values desired and Save as Default in the subVI.

 

Lynn

0 Kudos
Message 5 of 12
(4,143 Views)

I still run into the problem of labview yelling at me for using an output when I should be using an input. I am probably missing something simple. 

 

What data do I input into the shift register initially? Or is it an uninitialized shift register...?

0 Kudos
Message 6 of 12
(4,140 Views)
... the indicator is passive, and just displays whatever is in thr SR.
0 Kudos
Message 7 of 12
(4,139 Views)

*sigh* i think a picture would just help. This is what I have, and I am unsure how to wire that cluster so that I can use it within the rest of my code. 

0 Kudos
Message 8 of 12
(4,130 Views)

Don't know if this will help.

But anyway you didn't help a lot either ! :D:D:D

Here an example where a cluster is being read, written, written by pieces...

 

See attachment.

Chilly Charly    (aka CC)
0 Kudos
Message 9 of 12
(4,100 Views)

Hmm...so you create a constant for the cluster that you initially pass in? 

0 Kudos
Message 10 of 12
(4,097 Views)