# Multiplexing channels in Labview

#### dl324

Joined Mar 30, 2015
12,871
I am working on something similar and would appreciate if you could drop the vi.
This thread is almost 3 years old. You could have started your own.

Joined Jan 15, 2015
5,934
The chip, the 74HC4067 is a bi-directional multiplexer chip. The chip has 4 address lines which go like this:
To simplify things, 1 is HIGH, 0 is LOW
0000 – 0
1000 – 1
0100 – 2
1100 – 3
0010 – 4
1010 – 5
0110 – 6
1110 – 7
0001 – 8
1001 – 9
0101 – 10
1101 – 11
0011 – 12
1011 – 13
0111 – 14
1111 – 15

Since it is bi-directional and pin #1 is the common Input/Output what happens is if I address S0, S1, S2 and S3 with a binary 1110 for example Pin 1 is now tied to CH 7 which is Pin #2. The truth table is in the data sheet.

"These analog multiplexers/demultiplexers control analog voltages that may vary across the voltage supply range. They are bidirectional switches thus allowing any analog input to be used as an output and vice-versa. The switches have low “on” resistance and low “off” leakages. In addition, these devices have an enable control which when high will disable all switches to their “off” state".

So if I make S0, S1, S2 and S3 all low (Binary 0) all 4 bits are low then Ch 0 (pin #7) is tied to In/Out (pin #1) Keep in mind that while it is an analog MUX / DEMUX there is some On resistance (see the data sheet). So now I can choose any one of 16 channels for a uC or A/D converter. I can also use my uC to address each channel and place the results into an array and do whatever I want with. Pay attention to the data sheet especially for Vcc and maximum Vin per channel.

Also before I forget since you only need 8 channels if all 8 are from this chip it becomes 0 through 7 so you only need a 3 bit address S0, S1 and S2 and tie S3 to ground.

Ron

Last edited:

#### narek_ghazaryan

Joined May 2, 2020
6
Hi Ron,

I really appreciate your reply, I made a mux subvi out of the truth data with boolean input in order to activate the channels. I am very confused about the assignment of pins and the channels like you mentioned in your reply. Also, my acquisition card is not compatible with DAQmx, and the majority of examples and documents I encountered on the internet are with DAQmx and my card is compatible with ULx. So, I am very confused about the conversion and how to connect my card to the multiplex. Could you maybe help with a possible vi document that could direct me in terms of connecting th card with the multiplex and the whole conversion?
Thank you again for your reply and I don't mean to bother but would really appreciate your help!

Narek

The chip, the 74HC4067 is a bi-directional multiplexer chip. The chip has 4 address lines which go like this:
To simplify things, 1 is HIGH, 0 is LOW
0000 – 0
1000 – 1
0100 – 2
1100 – 3
0010 – 4
1010 – 5
0110 – 6
1110 – 7
0001 – 8
1001 – 9
0101 – 10
1101 – 11
0011 – 12
1011 – 13
0111 – 14
1111 – 15

Since it is bi-directional and pin #1 is the common Input/Output what happens is if I address S0, S1, S2 and S3 with a binary 1110 for example Pin 1 is now tied to CH 7 which is Pin #2. The truth table is in the data sheet.

"These analog multiplexers/demultiplexers control analog voltages that may vary across the voltage supply range. They are bidirectional switches thus allowing any analog input to be used as an output and vice-versa. The switches have low “on” resistance and low “off” leakages. In addition, these devices have an enable control which when high will disable all switches to their “off” state".

So if I make S0, S1, S2 and S3 all low (Binary 0) all 4 bits are low then Ch 0 (pin #7) is tied to In/Out (pin #1) Keep in mind that while it is an analog MUX / DEMUX there is some On resistance (see the data sheet). So now I can choose any one of 16 channels for a uC or A/D converter. I can also use my uC to address each channel and place the results into an array and do whatever I want with. Pay attention to the data sheet especially for Vcc and maximum Vin per channel.

Also before I forget since you only need 8 channels if all 8 are from this chip it becomes 0 through 7 so you only need a 3 bit address S0, S1 and S2 and tie S3 to ground.

Ron

Joined Jan 15, 2015
5,934
OK, you can do this. You have a USB 2020 card. This should be your card.
 2 Channels 12-bit Resolution 20 MS/s/ch Sample Rate

So your card offers you 2 analog channels which are Single-ended, individual A/D per channel which is fine. So here is what you do you can buy the MUX chip just as a chip and make a board or for my little projects I cheat and just but a ready made board with the chip on it. Here is an example of a complete breakout board, nice and organized and about $5 USD but I have seen these boards on Amazon for less and with pins included. So lets take a look at a board... Nice thing about the board is things are laid out in nice order, On the left we have C0 through C15 so we have 16 analog channels and you only need C0 through C7 which is 8 channels. On the top right threris a terminal labeled Sig (Signal). In your case you will run analog signals in on C0 through C7 and you address S0, S1 and S2 to determine which input will come out SIG. Think of it this way, 4 bits is 2^4 or 2*2*2*2 = 16 and there your 16 channels. But you only want 8 channels so you only need a 3 bit address and that's why I said take S3 and ground it. All addresses below Ch7 do not use it. So your 8 analog input channels connect to C0 through C7 and SIG is your out and gets tied to one of your 2020 analog in channels. Make sure everything shares a common Ground. The EN pin is a chip enable pin and I believe tied low (GND). Ron Thread Starter #### narek_ghazaryan Joined May 2, 2020 6 Thank you for your reply Ron, Yes, that is my card and I have already bought the ready board which you have on the picture and have already connected it to the acquisition card. I am just having issues with the LabVIEW aspect on how to get the multiplex channels to work. I have made 4 digital outputs which I thought should be connected to S0 to S3, but since you mentioned I don't need S3 so just need 3 digital outputs. Then I just don't understand and am confused about how to obtain the multiplex analog channel on LabVIEW. Do you know on how to get those multiplex channels on LabVIEW ? and how to get those to obtain info, so those will be inputs. I was looking on similar cases on the internet but couldn't find one that works with ULx. Have you had such projects or similar cases? Thank you for the explanation on the channels too! OK, you can do this. You have a USB 2020 card. This should be your card.  2 Channels 12-bit Resolution 20 MS/s/ch Sample Rate So your card offers you 2 analog channels which are Single-ended, individual A/D per channel which is fine. So here is what you do you can buy the MUX chip just as a chip and make a board or for my little projects I cheat and just but a ready made board with the chip on it. Here is an example of a complete breakout board, nice and organized and about$5 USD but I have seen these boards on Amazon for less and with pins included. So lets take a look at a board...

View attachment 206058
Nice thing about the board is things are laid out in nice order, On the left we have C0 through C15 so we have 16 analog channels and you only need C0 through C7 which is 8 channels. On the top right threris a terminal labeled Sig (Signal). In your case you will run analog signals in on C0 through C7 and you address S0, S1 and S2 to determine which input will come out SIG. Think of it this way, 4 bits is 2^4 or 2*2*2*2 = 16 and there your 16 channels. But you only want 8 channels so you only need a 3 bit address and that's why I said take S3 and ground it. All addresses below Ch7 do not use it.

So your 8 analog input channels connect to C0 through C7 and SIG is your out and gets tied to one of your 2020 analog in channels. Make sure everything shares a common Ground. The EN pin is a chip enable pin and I believe tied low (GND).

Ron

Joined Jan 15, 2015
5,934
Never really used labview much. We had it but by then I was pretty close to retired. This may help you out hopefully. While it's 4 bit you only need three.

You only need Bit 0, Bit 1 and Bit2 your clock rate will be how fast you cycle through analog channels of your MUX. Make sense?

Ron

#### narek_ghazaryan

Joined May 2, 2020
6
HI everyone,

I am wokring on this project and would really appreciate any kind of help!

So I’m relatively new to LabVIEW and am kinda confused about the usage of the multiplexer. I’m using usb 2020 card which has 2 analog and 7 digital channel but for my project I need 8 channels which would read data from the given surface. So I decided to use a multiplexer that offers 16 analog channels. cd74hc4067 But I’m confused on how to use those analog channels. I made a mux subvi with the truth table in order to enable the channels. I create 3 digital outputs and connect it to the subvi to get the outcome channel but then I don’t know how to use the channel since I only need 8 digital channels of the multiplexer. I have already bought the ready board and have already connected it to the acquisition card. I am just having issues with the LabVIEW aspect on how to get the multiplex channels to work. I have made 3 digital outputs which I thought should be connected to S0 to S3, but since I need only 8 channels I won’t need S3 so just made 3 digital outputs. Then I just don't understand and am confused about how to obtain the multiplex analog channel on LabVIEW. Do you know on how to get those multiplex channels on LabVIEW ? and how to get those to obtain info, so those will be inputs. I was looking at similar cases on the internet but couldn't find one that works with ULx. Have you had such projects or similar cases?

#### narek_ghazaryan

Joined May 2, 2020
6

I already have a counter, My issue is that I can't seem to understand how to work the multiplexer channels

Never really used labview much. We had it but by then I was pretty close to retired. This may help you out hopefully. While it's 4 bit you only need three.

View attachment 206111

You only need Bit 0, Bit 1 and Bit2 your clock rate will be how fast you cycle through analog channels of your MUX. Make sense?

Ron

Joined Jan 15, 2015
5,934
OK, lets try a little experiment. Tie S3 to ground. Place 5 Volts on pin 1 of the chip which is the I/O pin and labeled SIG for SIGNAL on the module. Place GROUND on GROUND pin. Make pins S0, S1 and S2 high (logic HIGH) and now measure CH7 output. You should see close to 5 volts. Think of it as a rotary switch with an address for each switch position. That's all there is, let's not make it complicated.

Binary:
One 1
One 2
One 4

1+2+4 = 7 and we are looking at channel 7 of the MUX.

Ron