LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

convert ascii to numeric

hi,
i´ve got a problem with messages received over rs232. i can´t convert the ascii messages like "é$" into a numeric display. i´ve already tried type casting. but it doesn´t convert them correctly.
i attached a picture that should explain it a little bit better.
0 Kudos
Message 1 of 10
(4,260 Views)
here is another picture of the results.
0 Kudos
Message 2 of 10
(4,255 Views)
Hi,

what is wrong with "Vorzeichenloses Byte-Array"? It seems to work fine, oder?

Maybe you want to interpret the two single bytes as a 16 bit value. Then you might try Array[0]*256 + Array[1], or vice versa, depending which one is the msb.

Regards
Matthias

Message Edited by matthias.richwin on 04-13-2005 10:48 AM

0 Kudos
Message 3 of 10
(4,250 Views)
yes this data is okay. but how can i put these bytes of the array together, to get one numeric number?
0 Kudos
Message 4 of 10
(4,241 Views)
Hi

If you for example read the following:

#$A (0x23, 0x24, 0x41 / 35d 36d 65d) you want to get the number 353665. Is this right?

Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 5 of 10
(4,230 Views)
no it isn´t quite right.
For example i read ascii:” which normally is 0x1194 = 4500d. but the type cast makes a 0x11940000 = 294912000d out of it.

Message Edited by reen on 04-13-2005 04:08 AM

0 Kudos
Message 6 of 10
(4,232 Views)
Hi,

then either try my suggestion given above, or change the data type of the "0" constant wired to the type cast to the appropriate type, i.e. U16.

Regards
Matthias

Message Edited by matthias.richwin on 04-13-2005 11:13 AM

0 Kudos
Message 7 of 10
(4,217 Views)
i´ve found a solution that delivers the "4500". thanks for taking time.
0 Kudos
Message 8 of 10
(4,210 Views)
Now you make a little mistake.

You don't have 0x1194 as one number - it just looks like if you see the string in hex-representation. In fact you still have two seperated values.
One is 0x11 and one is 0x94.
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 9 of 10
(4,208 Views)
your suggestion also works matthias.
thx.
0 Kudos
Message 10 of 10
(4,206 Views)