LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a two bit multiplexer

Solved!
Go to solution

Hello,
How could two bit multiplexer could be created using labview. 
That is there would be four inputs and one output.
The control of this should be numerically i.e when the numeric select control has input 1, the first input goes to the output and when it has 2 the second input goes to the output and so on.
I think that its not very difficult but needs an idea to be picked for the solution.

0 Kudos
Message 1 of 27
(7,339 Views)

Hi Intelligent,

there different possibilities. You can use a case structure or you build an array of your inputs and use index array to get the one you need.

 

Mike

0 Kudos
Message 2 of 27
(7,330 Views)
How it could through the Select function in the comparison palette.
0 Kudos
Message 3 of 27
(7,324 Views)

Hi Intelligent,

what do you mean?

Can you show your current program?

 

Mike

0 Kudos
Message 4 of 27
(7,317 Views)

Hi,

 

there might be several option, depending on what your "real" application should do at the end.

First question:

Is it fixed in your app, that you have 4 single values

Attached you´ll find two examples of how a kind of multiplexing could be done, if your selector is a numeric value.

 

Option1:

Build an array of the 4 values, and then use the "Index Array" function  for selecting one of the data points and give it to the output.

 -> Very easy to add new input lines to this "multiplexer"

 -> Remember that array indexing starts at index =, if you want to give the user a selection from 1 on.. yo have to decrement this for reading element at position 0 (which is the first in the array).

 

 Multiplexer.png

 

 

Option2:

Use a kind of case structure.

This is useful, when - depending on your selection, only one part of the code should be executed for saving processing time etc..

i.e. You have 4 devices connected via serial connection, depending on your multiplexer choice, you read one value from one of the devices:

 

 Multiplex2.png

 

 

Stefan

Message Edited by SK@NIG on 04-23-2010 02:54 AM
0 Kudos
Message 5 of 27
(7,316 Views)
I mean the select function present in the comparison palette. which returns output relative to the true or false condition of select input.
0 Kudos
Message 6 of 27
(7,310 Views)

The function you point to - "select" is a "1bit-Multiplexer". You can wire only boolean values to the selection input.

That means, for creating a 2bit or more multiplexer, you have to struggle with cascaded select functions.

 

The selector from the Comparison pallette is a simple "If/Else" construct, if you need more complex ones, use the Case structure or, for just selecting from several values, an "index array"

 

Stefan

0 Kudos
Message 7 of 27
(7,305 Views)

Hi Intelligent,

 

yes, you could use a series of Select functions too - all you need is 4 Selects, 4 comparisons and a default constant.

But that's not the way you should go in LabVIEW- it rather seems you want to convert some C code one-by-one to equivalent LV code...

Message Edited by GerdW on 04-23-2010 10:13 AM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 27
(7,304 Views)

Actually i am limited to do it by the select function.
and i know that it is only limited for two inputs than what to do for more inputs?
And also my inputs are in numeric form i.e. 1,2,3 and 4

0 Kudos
Message 9 of 27
(7,300 Views)

Hi Intelligent,

 

is this some kind of homework or practice we should solve for you???

 

You have to cascade the Selects similar to this:

IF Input1 THEN Output1

               ELSE IF Input2 THEN Output2

                                       ELSE IF Input3 THEN Output3

                                                              ELSE IF Input4 THEN Output4 ELSE Default

 

Come on, do something easy like this on your own! It's the best way to actually learn LabVIEW.

Act like your user name implies Smiley Wink

Message Edited by GerdW on 04-23-2010 10:23 AM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 27
(7,290 Views)