LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

unnecessary redundancies in my code?

Where do you get this arrow from?

controlIndex.png

0 Kudos
Message 11 of 22
(1,601 Views)

See the wire coming into it?  You might recognize that as a Cluster wire.  You are looking at the Unbundle By Name function, the "preferred" way to unbundle and obtain the contents of a Cluster.  The reason I say "preferred" is that you can see what the element is named and, especially if you have multiple elements of varying types, can be sure you are wiring to the correct terminal.  A "drawback" is that an Unbundle by Name function is twice as think as a plain Unbundle, but Good Style Wins, in my book.

 

Bob Schor

Message 12 of 22
(1,595 Views)

Never mind, found it. It's just a cluster, but you have to wire a data type up to it. How do you convert the string "label.text" into "ControlIndex"?

0 Kudos
Message 13 of 22
(1,592 Views)

Ok, I guess I should try looking harder before I start typing in here lol. Found what I needed

Message 14 of 22
(1,590 Views)

I got this all wired up in the way which I thought gregoryj had recommended, but now I'm running into some errors.

Maybe I'm misunderstanding some things. Why do I need to have that array for Control Indices? 

0 Kudos
Message 15 of 22
(1,579 Views)

Here's some tips to help you figure out what is going on.

 

1.  Click the broken run arrow.

2.  Read the dialog box telling you what is broken.

3.  Click on an error and hit Show Error.  It will take you to the problem.

4. Fix the problem based on what you read in step 2.

 

Notice the difference in appearance between your tunnel and the ones in GregoryJ's image.  Right click and pick Use Default if Unwired.

Message 16 of 22
(1,573 Views)

Should I move all the data acquisition stuff from the first for loop to this other one?

BigMove.PNG

0 Kudos
Message 17 of 22
(1,561 Views)

I have no idea.  You are now showing you have a larger VI, but you aren't actually showing it since it is a cut off screenshot.

 

It looks like you have multiple pieces of code that aren't really connected to each other, much of the code only runs once.

Message 18 of 22
(1,550 Views)

yeah, bad screen shot. I made another version where the acquisition portion of code is moved so that there is only 1 for loop running now, but it made kind of a mess out of the wires.

 

I still have a bunch of indicators sitting out in open space because I'm not sure if I should wire them up or how I should wire them up

 

Gregoryj was showing how to use the (control index) to an array for the 64 channels, but I'm not sure if that's for showing the readings from the 9213modules or just to change the BG colors of front panel indicators. Since the array connected to the (control index FOR loop) can be a control only and not an indicator I'm not sure what it's function is.

 

I attached two versions of the VI: One with 2 WHILE loops and one with a single WHILE loop

Download All
0 Kudos
Message 19 of 22
(1,535 Views)

@LabNoob14 wrote:

yeah, bad screen shot. I made another version where the acquisition portion of code is moved so that there is only 1 for loop running now, but it made kind of a mess out of the wires.

 

I still have a bunch of indicators sitting out in open space because I'm not sure if I should wire them up or how I should wire them up

 

Gregoryj was showing how to use the (control index) to an array for the 64 channels, but I'm not sure if that's for showing the readings from the 9213modules or just to change the BG colors of front panel indicators. Since the array connected to the (control index FOR loop) can be a control only and not an indicator I'm not sure what it's function is.

 

I attached two versions of the VI: One with 2 WHILE loops and one with a single WHILE loop


I think that the "_2" is much closer to what you want. That way you are acquiring data and checking it against your limit. A couple of notes:

  • The code which cleans up your DAQ tasks will never be run, because the only way to stop your while loop is by aborting the program. Aborting the code should not be done on a regular basis, but only in rare cases when the program gets stuck.
  • The term "ControlIndex" can refer to both a control and indicator. So if you set the value for an indicator's "ControlIndex", it will update the indicator.
  • The code to update the indicators should be put inside your while loop if you want your indicators to update as data comes in.
Message 20 of 22
(1,519 Views)