LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

string conversion

Hello folks,

I have a question about string conversion.

In an test application we send and receive HEX messages via CAN bus. For the test report the messages are converted from byte array to string and then formatted for the report. The result string may look like this:

APPL (023A870000): OK   // message_name (sent_can_command): result_of_answer
10165A8702918240         // read_can_answer

But now sometimes it happens, that the converted read_can_answer is not a HEX string but a decimal number string. For example:

APPL (023A870000): OK   // message_name (sent_can_command): result_of_answer
         2,5092E+14             // read_can_answer

Does anybody now, what happens there? I have really no idea. Attached is a little  VI, which shows, how the conversion is done.
In most cases the conversion works very well.

Any help is really welcome
Heinrich
0 Kudos
Message 1 of 5
(2,930 Views)
Hello Heinrich,
IMHO the problem must reside elsewhere. I cannot conceive any way to obtain a decimal string from this vi (unless there are very nasty bugs in LV!).

Paolo
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 2 of 5
(2,916 Views)

Hello Heinrich

Why are you converting to a hex string?

I think you should use the conversion to string (byte array to string) and then display this eventually in hex format.

Now you convert each byte to a hex string and that is not what you really want.

greetings from the Netherlands
0 Kudos
Message 3 of 5
(2,915 Views)
Heinrich-Hans wrote:
<cut>

I didn't fully understand what is it that you are having trouble with,
but if it is conversion from hex U8 number array to hex string maybe
this solution is what you are looking for:

http://www.sharanet.org/~joghurt/CANMsgTest2.vi
0 Kudos
Message 4 of 5
(2,882 Views)
Hello all,

just a short infoSmiley Very Happy

Yesterday we had a intensive discussion with our customer about this mess. And it is nearly clear, that the customer views the logfiles (by the way plain text) with an application that tends to do autoformatting (eg. Excel). The affected HEX strings contain only numbers, no HEX characters (A-F).
Strings containing HEX characters (A-F) are not affected.

I think case cleared; no nasty bug.
Regards
Heinrich
0 Kudos
Message 5 of 5
(2,861 Views)