LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data conversion from I32 to U8

Hello,

 

I have Data in I-32 ( 1D-Array 32 Bit)  and I want to convert it into U8 ( 1D-Array 8 Byte) how I can doing that with Labview? 

 

BR

0 Kudos
Message 1 of 7
(3,813 Views)

Give an example of the data you are trying to convert.  An I32 ranges from +/- 2,147,483,648, while a U8 is from 0 to 255.  So coercing data if it is negative or larger than 255.

0 Kudos
Message 2 of 7
(3,810 Views)

Assuming you only care about the bits and not the actual numbers, look into the Type Cast function.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 7
(3,803 Views)
To unsigned byte integer in Numeric --> Conversion
G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 7
(3,775 Views)

Hello, I have Lin Communication with RS232. At first I have Data with RS232-Write sent data [85.,125,23,2,39,5,255,255,255,255,186] so the Input ist a string in ASCII- Form. Data to send is 8 bit Integer so I convert the data at firt to I-32 then I use Convert number to Hexdecimal string.

With RS232 I try to get the answer, But the output string[553c17022705FFFF] so I try to to make from this string an Array [55,3C,17,02,27,05,FF,FF] and then I convert it with Hexdecimal string convert to Number in I32, then to U8 because, with data to rec and massage fram is in U8.

My problem is: to get the Data rec I have to use the Array-Subset where is the the array is the massage frame and the index is the message size from Data to send  + 1 = 12 .

My resut in data rec is array with only the first value[55,3C,0,0,0,0,...] and the other value is zero.

So i don´t know wher ist the error? Can you help me

The result in the Frontpanel is:

Message_Frame: 55,7d,BA,55,7D,55,FF,FF,0,0,0

Data_rec is: 55,7D,0,0,0,0,0,0,0,0,

I think I have problem with convert but i can not see the erorr

0 Kudos
Message 5 of 7
(3,765 Views)
You're probably starting off wrong, just use a U8array to string from the String pallette and send that.
G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 7
(3,748 Views)

Ok, maybe we should be asking this:  What does the original data look like and what do you want in the end?  I think you are over complicating things.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 7
(3,747 Views)