04-23-2010 02:24 AM
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.
Solved! Go to Solution.
04-23-2010 02:39 AM
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
04-23-2010 02:47 AM
04-23-2010 02:51 AM
Hi Intelligent,
what do you mean?
Can you show your current program?
Mike
04-23-2010 02:53 AM - edited 04-23-2010 02:54 AM
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).
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:
Stefan
04-23-2010 03:05 AM
04-23-2010 03:12 AM
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
04-23-2010 03:12 AM - edited 04-23-2010 03:13 AM
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...
04-23-2010 03:15 AM
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
04-23-2010 03:22 AM - edited 04-23-2010 03:23 AM
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