08-20-2014 01:53 AM
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
Solved! Go to Solution.
08-20-2014 02:02 AM
08-20-2014 02:11 AM
Hi GerdW,
Thanks for that prompt reply.
I'll try that out.
08-20-2014 04:41 AM
Hi GerdW,
Both the solutions worked.
Thanks for the help
Best Regards,
Snehal
08-20-2014 04:44 AM - edited 08-20-2014 04:44 AM
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… 😉