Showing results for 
Search instead for 
Did you mean: 

Convert 1D Array To Numeric Then Back To Array

Go to solution

Hello, I have a 1D array that contains the following:


Element 0 = MSByte of chip register (U8)

Element 1 = LSByte of chip register (U8)


What I want to do is take this 1D array convert it to numeric representation like the following:


Example if:


Element 0 = 1A hex

Element 1 = 44 hex


Conversion = MSM | LSB = 1A44 hex = 6724 dec


Then I want to AND this value with another value (0248 hex):


1A44 hex  ANDed with 0248 hex = 0240 hex


Then I want to take 0240 hex and split it back up into a 1D array like the following:


Element 0 = 02

Element 2 = 40


Is there an efficient way to take a 1D array, concatenate the arrays inputs, perform an AND function with another number, and then take the ANDed result and convert this value back to a 1D array with an MSByte (Element 0) and an LSByte (Element 1)?



0 Kudos
Message 1 of 3
Accepted by hobby1

Why don't you just AND it with an U8 array of x02,x48. No conversion or typecasting needed.



(If you really need the intermediary U16 values too, just typecast the array to a scalar U16, etc.)

LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 2 of 3

Thanks altenback.  I knew there was an efficient way to do this.

0 Kudos
Message 3 of 3