LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

conversion of hexadecimal file to decimal file in labview

hi all,

I took a measurement from an anemometer by its original program. I attached the file below. I want to convert this file to the decimal file. I all know is the data in file are in hexadecimal and 16-byte. How can I convert this file to decimal one? I prepared something as I saw in this forum but it gives me just one number. I attached the vi below too.

Egemen
Download All
0 Kudos
Message 1 of 32
(5,535 Views)

Hi ,

 

Refer this,

 

HEX to Decimal.png

 

Regards,

Bijay

0 Kudos
Message 2 of 32
(5,522 Views)

@newbieeng wrote:

hi all,

I took a measurement from an anemometer by its original program. I attached the file below. I want to convert this file to the decimal file. I all know is the data in file are in hexadecimal and 16-byte.


Do you mean 16-bit? Signed or unsigned?

 

 

For posted example: Reading the file as string and then converting to numbers is the wrong approach. It requires extra memory to create the strings and then to convert to numbers.

 

All you need is a single Read Binary File, with the appropriate data type set.

 

0 Kudos
Message 3 of 32
(5,515 Views)

Hi newbie,

 

it doesn't make sense to convert the filename to some other datatypes. You have to load the datafile first!

 

@Bijay: as the file is no spreadsheetfile it doesn't make sense to load it using ReadFromSpreadsheetFile!

 

You may try this:

check.png

The file seems to contain SGL values so I typecasted them. If that's not the case you use the U8 array to do your own computations...

 

Edit:

check.png

Using ReadBinaryfile is somewhat easier...

 

"the data in file are in hexadecimal and 16-byte."

The file isn't in hexadecimal, it's just binary. And what do you mean by "16-byte"???

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 32
(5,506 Views)

@smercurio_fc wrote:

@newbieeng wrote:

hi all,

I took a measurement from an anemometer by its original program. I attached the file below. I want to convert this file to the decimal file. I all know is the data in file are in hexadecimal and 16-byte.


Do you mean 16-bit? Signed or unsigned?

 

 

For posted example: Reading the file as string and then converting to numbers is the wrong approach. It requires extra memory to create the strings and then to convert to numbers.

 

All you need is a single Read Binary File, with the appropriate data type set.

 



the data is 16-bit unsigned. I wrote 16-byte wrongly. sorry for that.

Egemen
0 Kudos
Message 5 of 32
(5,505 Views)

@newbieeng wrote:
the data is 16-bit unsigned. I wrote 16-byte wrongly. sorry for that.

Then simply change the data type from I16 to U16.

0 Kudos
Message 6 of 32
(5,498 Views)

Hi,

 

Thanks for feedback GerdW.

 

Regards,

Bijay

0 Kudos
Message 7 of 32
(5,497 Views)

 


@GerdW wrote:

Hi newbie,

 

it doesn't make sense to convert the filename to some other datatypes. You have to load the datafile first!

 

@Bijay: as the file is no spreadsheetfile it doesn't make sense to load it using ReadFromSpreadsheetFile!

 

You may try this:

check.png

The file seems to contain SGL values so I typecasted them. If that's not the case you use the U8 array to do your own computations...

 

Edit:

check.png

Using ReadBinaryfile is somewhat easier...

 

"the data in file are in hexadecimal and 16-byte."

The file isn't in hexadecimal, it's just binary. And what do you mean by "16-byte"???


I wrote it wrongly. It must be 16-bit. It must be in hexadecimal. The manual of the program that I took this data file says the output is in hexadecimal format. 
Egemen
0 Kudos
Message 8 of 32
(5,491 Views)

 



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 9 of 32
(5,472 Views)

@GerdW wrote:

Hi newbie,

 

it doesn't make sense to convert the filename to some other datatypes. You have to load the datafile first!

 

@Bijay: as the file is no spreadsheetfile it doesn't make sense to load it using ReadFromSpreadsheetFile!

 

You may try this:

check.png

The file seems to contain SGL values so I typecasted them. If that's not the case you use the U8 array to do your own computations...

 

Edit:

check.png

Using ReadBinaryfile is somewhat easier...

 

"the data in file are in hexadecimal and 16-byte."

The file isn't in hexadecimal, it's just binary. And what do you mean by "16-byte"???


I tried your suggestion and find something what I really do not know what they are. I attached the results print screen. I will try the second solution.

Egemen
0 Kudos
Message 10 of 32
(5,467 Views)