LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help a Noob manage many channels and build an elegant program

neesea,

 

Thanks, I'll start working on what you've described. I do want to get this working for one task at a time, especially when it comes to all the indicators and color change stuff on the front panel.

Do you think I should try and put the indicator color changing code in a subVI? Maybe that will make it easier to duplicate 64 times for each channel.

 

I think I do have these tasks saved in MAX correctly and I don't expect channel configuration to change. How do I use them directly in LV?

I just set this up based on "help" in LV

 

 

0 Kudos
Message 11 of 33
(985 Views)

Like this?

bypass..PNG

0 Kudos
Message 12 of 33
(976 Views)

Yep, that should work.  If the task is already created and configured, there is no need to re-create it in your block diagram.

 

Next, change your DAQmx read function to "multiple channels, one sample".  In this mode, it will output an array of data with the same length and order as the channels contained inside the task.  If there's any question about what order that is, you can feed the task wire into a property node and retrieve the list of channels (which you can then convert to strings and use in your display, if desired).

 

Start by simply sending that data array to an indicator, to verify that you can see all 16(?) channels from that task.  If that works, we'll go to the next step.

Message 13 of 33
(968 Views)

Ok, this is much more simple than what was going on before. Should I be using a for loop instead of while?

16 channels verified and working

 

Ready for the next step!

 

simplified.PNG

0 Kudos
Message 14 of 33
(963 Views)

Cool.  You would only use a for loop if you knew exactly how many samples you wanted to record before you started.  The while loop will just run as long as want it to (which I think is what you want).

 

First: remove the 100ms wait from your loop.  The DAQmx read will automatically wait until there is a sample available (up to the timeout you specify).  This will effectively limit your loop rate to match the sample rate defined for your task, so there is no need for an additional wait.

 

Next: processing.  Use array min/max to get the max temperature value from the data array (is that what you needed to do? I forget).

 

Next: make it work for 4 tasks.  We will change the single task wire over to an array of tasks, and modify each stage of the code to handle that array.

1) change the DAQmx task constant to an array and fill in the 4 tasks

2) put the DAQmx start task into a for loop and use auto-indexing tunnels for the purple wire.  This will start each task one at a time.

3) put the DAQmx read into a for loop (read from each task one at a time).  Include any task-specific processing such as array min/max in this loop.  Use auto-indexing on the data output(s) to create array(s) of results.  You might, for example, end up with a 2 dimensional array of temperatures (4 tasks by 16 channels) or a single 4-element array of maximum values.

4) put the DAQmx stop/close tasks into a for loop (close each task one at a time).

 

See if you can get that to work and display/process all 64 channels.

Message 15 of 33
(952 Views)

@neesea wrote:

First: remove the 100ms wait from your loop.  The DAQmx read will automatically wait until there is a sample available (up to the timeout you specify).  This will effectively limit your loop rate to match the sample rate defined for your task, so there is no need for an additional wait.


That only works if you are using hardware timing.  The OP is not.  They are reading 1 sample at a random time.  So the 100ms wait is valid.

 


@neesea wrote:

3) put the DAQmx read into a for loop (read from each task one at a time).  Include any task-specific processing such as array min/max in this loop.  Use auto-indexing on the data output(s) to create array(s) of results.  You might, for example, end up with a 2 dimensional array of temperatures (4 tasks by 16 channels) or a single 4-element array of maximum values.


I would do the Max/Min outside of the read FOR loop.  The reason being that each task is likely to have a different number of channels.  This makes a 2D array non-optimal.  Instead, use the Concatenating tunnel.  This will give you a 1D array for all of the channels (1 sample per channel).  Now you can do all of the analysis with this single array.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 16 of 33
(948 Views)

Crossrulz,

Good point about timing.  Keep the wait in there if you don't have hardware timing.

 

As far as output, it all depends on what OP is doing with the data.  I assumed he wanted it organized by task, in which case Array of Cluster of Array might be one option to deal with the issue of differing channel counts.  Using a concatenating terminal makes it harder to identify what task the channel came from.  I think it just depends on what you want to do with the data.

Message 17 of 33
(941 Views)

neesea, Crossrulz

 

The amount of channels shouldn't change anytime in the near future. They are basically going to be 16 for each module at all times.

0 Kudos
Message 18 of 33
(935 Views)

neesea,

 

I want to get the min/max for each channel and show the max statically through the duration of the VI execution. I also want to show the current temperature of each channel as well as the max it had reached.

 

After messing around with the array indicators and bg colors it looks like I'm going to have to index the arrays into individual indicators to get the colors to change independently from each other?

0 Kudos
Message 19 of 33
(934 Views)

@neesea

Here's where I'm kind of stuck. I can't seem to find out where to set the numeric bg color for the arrays.

addinbgs.PNG

0 Kudos
Message 20 of 33
(924 Views)