From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Transmitting the payload hex bytes as is to a excel sheet as it converts to dec

Attached is the modified NI-XNET subVI - CAN Frame to Table. Transferring the hex data stream to a file (.txt, .xcl) causes the stream to convert to decimal. How can it be saved in its original hex format? That is the issue. 

0 Kudos
Message 1 of 14
(3,594 Views)

Excel data sheet for the same program.

0 Kudos
Message 2 of 14
(3,593 Views)

I can't see how you are writing to your file but try the %x format so numbers are written as hex numbers instead of the default (floating point decimal %f).

 

Or posibly the %S so they are writtne as strings, then maybe Excel will not reformat them to decimal.

 

Also you can highlight the cells and use "format cells" in Excel to change the format to Hex

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 14
(3,555 Views)

CAN Frame to Table VI reads the data through write delimited spreadsheet VI. Write spreadsheet string is one of the subVIs in delimited speadsheet. I tried changing the formats to %x and %s but it changing back to %d when it starts running. That could be the problem. Now; I think, the issue is how can the default value can be changed and set in the Write delimiyted spreadsheet VI program. You advise is greatly appreciated.    

0 Kudos
Message 4 of 14
(3,506 Views)

Where is the VI that calls the Write Delimited String?  Does the CAN VI have a format input?


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 5 of 14
(3,500 Views)
0 Kudos
Message 6 of 14
(3,489 Views)

Since you are already using a modified version, just add a constant to the CAN VI to set the format.  That format is then passed into the Write Delimited Text File.


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 14
(3,486 Views)

@mjafarin wrote:

CAN Frame to Table VI reads the data through write delimited spreadsheet VI. Write spreadsheet string is one of the subVIs in delimited speadsheet. I tried changing the formats to %x and %s but it changing back to %d when it starts running. That could be the problem. Now; I think, the issue is how can the default value can be changed and set in the Write delimiyted spreadsheet VI program. You advise is greatly appreciated.    


Are saying this does not work?

hex.png

 

 

Once you have it in Excel formatting the colums as text makes them lineup left justified.

========================
=== Engineer Ambiguously ===
========================
Download All
0 Kudos
Message 8 of 14
(3,451 Views)

What do you mean it is turning it back to %d?

 

If you change the constant to %x, it stays, and works.  At least for me in LV 2015.  If it isn't for you, that would be the sign of a major LabVIEW bug.  Unless you are doing something different than what you are describing.

0 Kudos
Message 9 of 14
(3,446 Views)

In fact this is exactly what is happening. Unless there are some hidden steps/configurations that I am not aware of. 

Download All
0 Kudos
Message 10 of 14
(3,426 Views)