LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Limited number of inputs due to connector pane

Solved!
Go to solution
Highlighted
Solution
Accepted by topic author govindsankar

Attached an example using variant attributes - You could easily replace the variant with an array, and replace the 'ID' with an index. (Pass an index of -1 to an a new item, or add a new state for add new item).

 

If you would always read and write all the values at once, replace the number with a cluster.

0 Kudos
Message 11 of 23
(186 Views)
Highlighted

 


@govindsankar wrote:

In my original code, I am using cluster. I have 24 inputs, i group them into 8 clusters having 3 inputs each, so I have 8 inputs. In this program, I just used 8 numeric to show everyone how I am doing the program to correct my mistake.


So use an array of clusters.  Each cluster consisting of the 3 inputs.

Message 12 of 23
(186 Views)
Highlighted

You can ofcourse also break up the FGV.

/Y

G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
0 Kudos
Message 13 of 23
(177 Views)
Highlighted

Attached an example using variant attributes - You could easily replace the variant with an array, and replace the 'ID' with an index. (Pass an index of -1 to an a new item, or add a new state for add new item).

 

If you would always read and write all the values at once, replace the number with a cluster.

 

Thank you very much, this was what I want, how to set index to an FGV. Thank you very much.

0 Kudos
Message 14 of 23
(163 Views)
Highlighted

If all you are doing is a Get/Set, then you might as well just use a normal Global Variable.  But changing to the Variant Attributes where you also have a lookup makes the FGV setup necessary.  Even then, you could use a Data Value Reference and get a little more performance out.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
0 Kudos
Message 15 of 23
(159 Views)
Highlighted

Attached an example using variant attributes - You could easily replace the variant with an array, and replace the 'ID' with an index. (Pass an index of -1 to an a new item, or add a new state for add new item).

 

If you would always read and write all the values at once, replace the number with a cluster.

 

Thank you very much. Instead of having 8 inputs to 1 fgv. now i have 1 fgv with the input and then 8 copies of the same fgv with different ids. That is what I actually wanted, since I was unable to do that, I thought I will put all inputs into 1 fgv. These 8 inputs are from 8 motors, so I can name each copy of my fgv as motor1, motor2 etc. Thank u very much, I have been trying to do this for over 2 weeks. 

0 Kudos
Message 16 of 23
(156 Views)
Highlighted

@crossrulz wrote:

If all you are doing is a Get/Set, then you might as well just use a normal Global Variable.  But changing to the Variant Attributes where you also have a lookup makes the FGV setup necessary.  Even then, you could use a Data Value Reference and get a little more performance out.


How would using a DVR improve performance? Or do you mean just passing the variant around by reference instead of using the FGV?

 

0 Kudos
Message 17 of 23
(152 Views)
Highlighted

@paul.r wrote:

 Or do you mean just passing the variant around by reference instead of using the FGV?

Yes.  For more details: A Look At Race Conditions


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
0 Kudos
Message 18 of 23
(142 Views)
Highlighted

paul.r ACTIVE PARTICIPANT
‎12-06-2018 08:47 AM

Attached an example using variant attributes - You could easily replace the variant with an array, and replace the 'ID' with an index. (Pass an index of -1 to an a new item, or add a new state for add new item).

 

If you would always read and write all the values at once, replace the number with a cluster.

 

I have a new problem. I did the same thing , creating an fgv with , init,set and get as the states and used set variant attribute and get variant attribute inside the set and get methods. But here the value passed into the fgv is an array. Now when I run the program, the first time I set and then try to get, I get the exact values. Second time onwards I am not getting new values, even though I changed the values in the input, the output is showing the same values  of the first time. I tried running in highlight execution mode, then I found it goes properly to both set and get states, but the value coming out from the get state is the value I set during the first time. I have attached the program. Please tell me what is the problem. 

0 Kudos
Message 19 of 23
(104 Views)
Highlighted

Your calling VI doesnt make much sense and is likely the source of your issues - the uninitialized 'state' shift register is going to give different results depending on when you stop the VI. 

 

A few tips - make the FGV itself private, and create wrappers for the different functions. This makes it much easier to see where the various states are being called, rather than having to search through every instance to find the particular uses you are interested in. Also, why are you turning the array into a cluster? Just put it into the look up table as an array. 

Message 20 of 23
(99 Views)