LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

concatenate two 8-bit integers into single 16-bit integer

Both do the same and work binary. If you want to do BCD logic then that is an entirely different topic. But the examples in the first post are not really BCD either. A byte value of 50 decimal is not BCD!

Rolf Kalbermatter
My Blog
0 Kudos
Message 11 of 15
(492 Views)

This recreates your example without the bitwise issues. 

Snip.png

—Ben
Prevent your computer from sleeping programmatically!
Use Power Requests
Download from GitHub

0 Kudos
Message 12 of 15
(465 Views)

@Ben_Manthey wrote:

This recreates your example without the bitwise issues. 

Snip.png


While it is certainly possible that some hardware, somewhere, under some strange circumstances requires this sort of conversion, I would argue that it is pretty stupid. BCD numbers (where decimal digits are encoded in 4 bits each) are already kind of weird nowadays although they were quite common in the 70ies of last century for pocket calculators) but this would simply be at least one magnitude weirder.

Rolf Kalbermatter
My Blog
0 Kudos
Message 13 of 15
(435 Views)

Yamaeda_0-1707912688361.png

 

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 14 of 15
(411 Views)

@Rajsakthi wrote:

I have an array of four elements as a numeric value. Lets take element 1 is 90 and element 2 is 50 and element 3 is 70 and element 4 is 60 i need an output as reverse of first two elements result should be 5090 and another one is 6070.if anyone have some suggestions let me know it will be helpful.


 

Obviously, the quality answer can often not exceed the quality of the question, and your question is quite ambiguous.

 

It also helps to give some context, for example explain what the number represent and where they come from.

 

You don't say what the display format of your numeric values are, for example 90 (decimal) is not the same as 90(hexadecimal), but the suitable answer critically depends on it.

You also don't define what should happen in the input array has an odd number of elements (truncate or pad?).

 

Here are solutions to two possible interpretations of the question, one for each display format: Both will drop the last element if the input has an odd number of elements. Note that all controls/indicators show the radix for clarity.

 

altenbach_2-1707946456489.png

 

Obviously, U8 can have values from 0..255 (or 0..FF in hex). For the decimal solution you would also need to define what should happen if input values are above 99, if that is a possibility (create error? create a 6 digit output? something else?).

 

0 Kudos
Message 15 of 15
(382 Views)