ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a two bit multiplexer

Solved!
Go to solution

A case structure is nothing more than a select for more than two possible options.

 

You have to select between two items --> use the comparison--> select

You have to select betwenn more than 2 items --> use a case structure with a numeric value as selector.

 

compared to C it´s similar to use if/else or switch/case .

 

I my post above, you can download the VI snippets (drag into a block diagram of LV 2009 - When using IE drag and drop, when using Firefox, save as on desktop and then drag/drop)

0 Kudos
Message 11 of 27
(2,501 Views)

To GerdW
And how to control the four digital inputs through one numeric input 

0 Kudos
Message 12 of 27
(2,491 Views)

Hi Intelligent,

 

as you have 4 possible output values you need 4 inputs to provide them(plus the additional "multiplexer" input)!

Or what else do you ask for???

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 13 of 27
(2,487 Views)

I mean the decision inputs. which will be 1-4 numeric values and the control input of the select function are also 4 but boolean so how to use them.

0 Kudos
Message 14 of 27
(2,481 Views)
Solution
Accepted by Getwonder

Hi Intelligent,

 

don't you have one selector input, which allows several values?

 

The easiest way to get a boolean value is by using a comparison function like "Input==1". Or how is it done in C?

 

As already said in message #8: "all you need is 4 Selects, 4 comparisons and a default constant". Please read answers you have been given carefully!

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


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 15 of 27
(2,479 Views)

Hi intelligent,

you´re now talking about 4 values and 4 (corresponding) selectors?

In your first post you asked for a 2-bit-multiplexer, now you have a 4-bit?

 

Independant if you have two or for bits:

You can build an array of Boolans, then convert the boolean array to a number and use this number as selector for a case structure.

 

You´ll find more hints under:

LabVIEW menu -> Help-> Example Finder ->  Fundamelntals-->  "Numeric and Boolean" and "Array and Cluster"

 

Or try GerdW ´s version with the 4 select and so on...

Message Edited by SK@NIG on 04-23-2010 04:07 AM
0 Kudos
Message 16 of 27
(2,473 Views)
Thanks very much Mr. GerdW
I got the solution.
For information is there any method in which we should not be limited of using the comparison (equal to) parameter.
Thanks again.
0 Kudos
Message 17 of 27
(2,467 Views)

hi SK@NIG
i was questioning to the solution provided by GerdW

0 Kudos
Message 18 of 27
(2,460 Views)

Hi Intelligent,

 

"not be limited of using the comparison (equal to) parameter"

 

You want to select an output value according to a parameter. So you have to compare that value! You could do the comparison by using functions from the comparison palette or let a Case structure do that for you or use an IndexArray to do so... They all do some comparison!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 19 of 27
(2,458 Views)
OK and Thanks again
0 Kudos
Message 20 of 27
(2,451 Views)