LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Formation of an U8 Command with given input values

Solved!
Go to solution

Hello all,

 

I want to generate an U8 command with given input values-

 

Command is generated using follwing parameters that user would input - 

 

   Q2

               PAGE

                Constant

    Q1

P2

P1

P0

  0/1

These 3 bits form a page

    0

     0

    0

    0/1

 

Where,

Q1 & Q2  are qualifiers whose values can be either 0 or 1 binary.

P2,P1,P0 bits form the PAGE.

 

Now I want to develop a VI where user will enter Q1,Q2 and PAGE value from 0x0 to 0x7 and a U8 command should be generated from these three inputs.

For eg. if Q2=0,Q1=1 and PAGE=0x5, then output of the VI should be an U8 command 0x51.

 

I tried this using a Join Numbers function but it outputs a U16 which is undesired.

So,I guess this should be done using some of the bit manipulation techniques like ANDing.

Kindly help me in this regard.

 

Best Regards,

Snehal

0 Kudos
Message 1 of 5
(733 Views)
Solution
Accepted by topic author SnehalLVLover

Hi Snehal,

 

two possible solutions:
check.png

Best regards,
GerdW
CLAD expired, using LV2011SP1 + LV2017 (+LV2019 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

0 Kudos
Message 2 of 5
(730 Views)

Hi GerdW,

 

Thanks for that prompt reply.

 

I'll try that out.

0 Kudos
Message 3 of 5
(718 Views)

Hi GerdW,

 

Both the solutions worked.

Thanks for the help

 

Best Regards,

Snehal

0 Kudos
Message 4 of 5
(696 Views)

Hi Snehal,

 

this task is just a simple building of an boolean array. You can go the long way and really build a boolean array or you go the shorter way of manipulating integers numbers as shown above.

All you need is some basic understanding of binary math… 😉

Best regards,
GerdW
CLAD expired, using LV2011SP1 + LV2017 (+LV2019 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

0 Kudos
Message 5 of 5
(693 Views)