07-10-2018 01:56 PM
First of all thank you for taking an interest in my project!
Project: I have a room that is basically in the shape of a box and on 4 walls of the box there are going to be a number of TC locations. I need to be able to read these locations temperatures, identify the maximum temps, display this information in real time on a front panel and data log all the points over a duration of time.
With community help I've managed to create a VI that does what I need it to do for 1 channel coming from my cDAQ9213.
I have 3 other 9213s for a total of 64channels, I have them running through a network switch and all channels appear to be functioning correctly in MAX.
My question to the experts is: How can I read all these channels in labview like how I have it set up for the single channel without having to cut/paste that section of code 63 times over, which I'm sure is probably horribly inefficient. I want to be able to maintain the color controls universally for all channels so obviously that portion of code does not need to be replicated for each channel.
On the front panel I want to set up each channel with it's Max Temp(Mt0) and Current Temp(Back0) in a pattern that mimics the physical locations of the TC's possibly with an image behind the indicators.After those steps are completed I want to be able to data log all these channels with a time and date stamp(on a different tab) with a user control that will define how often a reading is logged, but will not interfere with the timing of readings on the front panel. (The data logging portion I'm not concerned about quite yet. One step at a time, I need to read and display all 64 channels properly)
Thank you for your help and please bear with me I'm learning as I go.
07-10-2018 02:09 PM
Arrays will be your friend here. You can set up a single DAQmx task to read all 64 of your channels (use a FOR loop to create the task) and then use the Single Sample Multiple Channels type for the DAQmx Read. Some of your code will just still work. You will run into issues with your Max & Min and color boxes, but you can find ways around those.
07-11-2018 10:05 AM
Are you saying I should replace the WHILE loop with the FOR loop or add a FOR loop in front of the WHILE loop to manage each individual channel one at a time?
Do you perhaps have a short example of the basic structure?
Thanks
07-11-2018 11:09 AM - edited 07-11-2018 11:09 AM
Based on your VI
07-11-2018 04:03 PM
I'm guessing this is NOT how to add 64 channels.
And when I try to make a single task in MAX with all modules and channels I get this error
07-11-2018 05:11 PM
You can only have 1 chassis in a task. So you will have to split up into a task per chassis.
07-12-2018 09:04 AM
Am I on the right track with this?
07-12-2018 09:08 AM
When you get a broken run arrow, then the answer is "no".
Why are you trying to take the array size of a DAQmx reference wire? It is a single reference, and not an array of references.
07-12-2018 09:25 AM
You're getting there. As you've found out, you will need 4 tasks since you have 4 crates. Each task contains some number of channels. Start by making it work for ONE task and then we can scale it from there.
The for loop's job is to add channels to a task. So you need to create an ARRAY of channels, and send it into that for loop using an auto-indexing terminal. That way, the loop will run exactly one time for each channel in your array, and add that channel to the task. Don't put all your tasks in the same for loop because that'll force them all to have the same number of channels (which may not always be the case).
Once it works for one task, we can put the whole thing into a second level of for loop and create an ARRAY of tasks, each of which contains some number of channels. In this way, your code will be scalable for any number of tasks/channels.
As an alternative to all this, you could simple create your 4 tasks directly in MAX, save them there, and just use them directly in your code without having to create them every time you run the VI. If you don't anticipate the channel configuration changing frequently, this may be an acceptable solution.
07-12-2018 09:50 AM
RavensFan,
That was a left over piece of code from a previous example someone showed me, I'm not sure what to do with it or if I'm going to use it later on.