‎06-16-2023 11:27 AM
Hi I am currently an intern try to learn LabView for a project. My mentor wants to use a multiplexer to switch between channels and continuously record data. I've attached an image depicting we want to build. This is just kind of a first step project to get a foothold to using the multiplexer and LabView data collection. I have tried looking online at the documentation, but it is very confusing. One of the National Instruments examples uses a digital multimeter (which we do not have). We want to use the DAQmx read function to read voltages instead.
 
‎06-16-2023 12:06 PM
What model of multiplexer switch and DAQ devices are you using?
‎06-16-2023 01:10 PM
NI PXI-2503 for the multiplexer and the DAQ device is NI PXI-6143.
‎06-16-2023 08:09 PM
Start with NI Max to do a sanity check and see if you can read voltages from the DAQ and the same with the mux.
Get familiarize yourself with DaqMX for making voltage readings, study the examples in Labview, and do the same for the switch.
THe program as it says in your diagram, you need to switch to the position and read the volage.
Create a subroutine for Switching the mux and another for daq reading.
ONce you have them, you will need to create the program where you swith , wait and read. If you are doing it continuously you will need a while loop to do it continuously until there is a user interaction to stop.
‎06-17-2023 06:03 PM
Thanks for the long reply.
I should have clarified this in my original message but I have already figured out how to read voltages and write and read them to a TDMS file. We also manually switched the connected ports of the mux and tested to see if voltages could be read. My main problem is I don't understand how to use the ni switch blocks to configure the mux and then switch between channels in some sort of while loop. I also don't know how much of an issue this is but making sure the program waits to switch until a measurement has been made to then switch channels.
‎06-19-2023 08:30 AM
I created a very simple draft of what the program could look like.
You will need a while loop that continuously execute the code :
In the For loop that switches to one channel at the time
from I=0 to Number of channels
{
- Mux Switch to Channel ( the channel number has to be an input into this Block- wire the i - (integer) it adds one at everyiteration
- Wait Mseconds
- Read Analog Input
}
You will have to place the blocks that switch and Read AI at ever location.
 
‎06-20-2023 12:32 PM
Ok thanks so much.
For anyone else wondering what I was confused about for their own projects. First you have to configure the path in the set path block using com0->ch0,ch0->ch1, and so on. Second you need to make a sequence structure to first disconnect all channels and (make a list of paths) and connect that channel in the list to com0 using the connect channel block.
If anyone wants the code (my solution is a little janky), reply to this message and I can send it!