LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing a Hex string to a file

I am reading a hex value from the serial port, and I want to write this value to a file.  When I try to write the value now, I get the following:
 
ƒ0
XSRØ
 
But it should be:
 
8330 0D58 5352 D801 0000 1029 2822 1106 EC00 7F08 0400 5C00 0000 0000 0000 0000 0000 0000 0000 0D0A
 
 
I have tried the various converters in LabView, but have had no success.
 
Any help would be appreciated.
0 Kudos
Message 1 of 7
(5,414 Views)

Hello,

It seems that what you want are the ASCII characters that *represent* the hex characters in your string.  There may be an easier way to do this, but the first way I thought of is shown below:

See if this helps.  I have also saved the VI in LabVIEW 7.1 format and attached it below.

Good luck,
-D

Message Edited by Darren on 03-22-200611:53 AM

Download All
Message 2 of 7
(5,409 Views)
Thanks for the help!
0 Kudos
Message 3 of 7
(5,393 Views)
Well, it really depends how you want to look at it. 😉
 
You could just write the raw hex string to a file, then look at the file in a hex editor. 😮
(This is often the method of choice, especially if you want to read it again later with a program).
 
It seems you want ASCII formatted text showing each double octet with 4 digits (0...F), followed by a space. If your string always contains an even number of digits, you could just cast it as U16. This would simplify the code a bit. See attached modification of Darren's example (LabVIEW 7.1).
 

Message Edited by altenbach on 03-22-200611:11 AM

Download All
0 Kudos
Message 4 of 7
(5,394 Views)

Here you go:

 

See File attached hex snippet.png

0 Kudos
Message 5 of 7
(4,718 Views)

@Marcano7 wrote:

Here 

 

See File attached hex snippet.png


1. You are replying to a 12 year old thread.

2. Your code really does nothing but give you the string you started with.  Not very helpful.


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 6 of 7
(4,709 Views)

@crossrulz wrote:

@Marcano7 wrote:

Here 

 

See File attached hex snippet.png


1. You are replying to a 12 year old thread.

2. Your code really does nothing but give you the string you started with.  Not very helpful.


3. Your code does not work for strings longer than what fits into a I32. Very limited and thus does not work for the original problem.

0 Kudos
Message 7 of 7
(4,692 Views)