Jump to content

Hexadecimal String to number


Recommended Posts

Hi to all,

I just spent some time searching the forum, but unfortunately I did not found a satisfying result...

The communication to set up should be using the RS-232 interface. I am using VISA configure serial port -> write -> read -> close (LW 7.1)

I got an auto-correlator which returns me 256 equidistant ACF-values as a row of 512 Byte with the following structure:

1.byte

00(hex)...FF(hex)

2. byte

00(hex)...C0(hex)

.

.

.

511. byte

00(hex)...FF(hex)

512. byte

00(hex)...C0(hex)

For that I am using the VISA read, which gives me the correct 512 bytes after sending the "GetACF" command.

By placing an indicator at the output of the VISA read and changing its properties to "hex" I see the right string.

For further processing I need to convert it into numbers. Using the "Hexadecimal String to number" does not seem to work.

For sure, it is my fault, but I already tried different number representations (which is the only thing to modify)

Here the first 10 bytes of my signal:

04E3

04EE

04FD

04F4

04FA

Using a probe data between the VISA read (read buffer out) and the Hex string to number does not indicate me the hex string, but any symbols.

Could this be the problem???

Thank you in advance for any hints.

Link to comment

Hi to all,

finally I am using Unflatten from String in a While Loop.

It works fine, just that HEX numbers above Axxx appear negativ :-\

Also with the Type Cast, they become negative, although I am using a 16bit word as type.

EDIT: ok, now it works fine. I just had to change the type to "unsigned Word" :D

Anyway, thanks a lot for your help :)

Link to comment
  • 1 year later...
Hi to all,

I just spent some time searching the forum, but unfortunately I did not found a satisfying result...

The communication to set up should be using the RS-232 interface. I am using VISA configure serial port -> write -> read -> close (LW 7.1)

I got an auto-correlator which returns me 256 equidistant ACF-values as a row of 512 Byte with the following structure:

1.byte

00(hex)...FF(hex)

2. byte

00(hex)...C0(hex)

.

.

.

511. byte

00(hex)...FF(hex)

512. byte

00(hex)...C0(hex)

For that I am using the VISA read, which gives me the correct 512 bytes after sending the "GetACF" command.

By placing an indicator at the output of the VISA read and changing its properties to "hex" I see the right string.

For further processing I need to convert it into numbers. Using the "Hexadecimal String to number" does not seem to work.

For sure, it is my fault, but I already tried different number representations (which is the only thing to modify)

Here the first 10 bytes of my signal:

04E3

04EE

04FD

04F4

04FA

Using a probe data between the VISA read (read buffer out) and the Hex string to number does not indicate me the hex string, but any symbols.

Could this be the problem???

Thank you in advance for any hints.

Hi,

How would you create the string that you send using VISA that represents an integer of a number between 1 to 5.

is this correct before converting to hex?

I used this string before converting to hex. Is this format correct for sending a message of a integer?

0x00 0x09 1 1 2

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.