08-09-2018 01:50 PM
Hello,
I have a DAQ with 4 channels with analog inputs. Right now, I am only using ai0, the first analog input channel which I configured by going directly into the DAQ Assistant block and choosing the channel. I am soon going to have to use multiple channels, and I would like to make a user-friendly interface in which they choose which channels to make active. My thinking was making 4 toggle/switches for each channel which the user can easily make active/inactive and plug in the appropriate wires to the physical channels.
How do I go about doing this; how and where do I connect these booleans to do what I described? Thank you.
08-09-2018
01:56 PM
- last edited on
12-19-2024
03:45 PM
by
Content Cleaner
Hi laps,
your task will become easier once you get rid of the DAQAssistent and use plain DAQmx functions!
You still can use 4 buttons then (or an array with 4 button elements): with each enabled button you can add/append another channel to your channel string…
08-09-2018 02:01 PM
I'm just going to redirect you to a recent thread: https://forums.ni.com/t5/LabVIEW/Selecting-channels-with-a-Boolean-control/m-p/3819305
08-09-2018 03:43 PM - edited 08-09-2018 03:47 PM
First, don't go with the bool or four bools Use a listbox with the output as array and selection mode 0 or more (auto index the indices to build the channels from the array of selections)
Ala Kazam!
Nicely SCALEABLE!
Second, DON'T DO THAT!
So, You got 4 AI Channels. Read them ALL ALL THE TIME! Use The Plot Visible Property to display only what is interesting and (Just saying here) Read the plot visible property to stor only the channel data of interest *(to TDMS of course)
NOTE: The For loop should auto-index on all AI, My device has more than 4 AI.
08-10-2018 12:43 AM
Hi Jeff,
Nicely SCALEABLE! Second, DON'T DO THAT!
There are cases where you don't want to read all available channels. In such cases you only put the channels in the task that you really need!
Example: using a multiplexing ADC DAQ card and you want/need to minimze the (timing) delay between the samples…
08-10-2018 07:51 AM - edited 08-10-2018 07:56 AM
@GerdW wrote:
Hi Jeff,
Nicely SCALEABLE! Second, DON'T DO THAT!
There are cases where you don't want to read all available channels. In such cases you only put the channels in the task that you really need!
Example: using a multiplexing ADC DAQ card and you want/need to minimze the (timing) delay between the samples…
With 4 AI channels it's a safe bet that the device is in a C DAQ or C RIO and hence is simultaneously sampled.:D. Option second in that case.
I did post the other method too.
Of course, for the high speed sequentially sampled... reading them all all the time highlights ghosting setup issues and trains the techs to watch for that.
08-13-2018 08:22 AM
Hi Jeff, I wanted to try your latest code but I don't think it is saved as a snippet somehow or I am just not importing it correctly? I tried dragging your image directly onto my block diagram but just a blue hyperlink appeared instead. I saved your image as a .png and dragged the file from windows explorer onto my block diagram page and your image appeared but it wasn't code; it is just an uneditable image... How would you advise?
08-13-2018 08:40 AM
@laps682 wrote:
I saved your image as a .png and dragged the file from windows explorer onto my block diagram page and your image appeared but it wasn't code; it is just an uneditable image.
What version of LabVIEW are you using? Do notice that the snippet was saved with LabVIEW 2017.
08-13-2018 08:48 AM
Ah I'm sorry, I have 2018... Is there any way to convert or make it compatible or should I just replicate from scratch?
08-13-2018 08:57 AM
Hi laps,
1. click the snippet image to start the forum's image viewer.
2. Download the image from that image viewer using it's download button.
3. Create a new VI, open its block diagram window.
4. Drag the saved image from your download folder into the block diagram.
Ready!
(That's how snippets work!)