Showing results for 
Search instead for 
Did you mean: 

Decimal number to hexadecimal string

Hi everyone ,

I convert number to hexadecimal string, the conversion in ok .I get what I want it(I place indicator which show me that value) . but when I send it serially its different.

I would greatly appreciate someone take a look at the attached screenshot .

thank you.


0 Kudos
Message 1 of 5

We cannot tell from a picture what you are doing, especially since you don't show the display style, datatype of constants, or radix.


What's in the U16 array? What are all elements of the string array? What's the point of the typecast? What size string do you expect after the FOR loop? What is a "hex integer string"? What's the logic behind the code? Why is there a coercion dot?


Please attach your VI. Also give a link to the manual for the device.


@lal_00 wrote:

but when I send it serially its different.


I am sure you are aware that there a millions of ways to be "different". What's the difference???? Explain in detail!


0 Kudos
Message 2 of 5

Its I part of another code. but I attached the screenshot which shows who I used it.

and I also attached vi.

I am sending it through Ebyte e32.

thank you for your response.

Download All
0 Kudos
Message 3 of 5

So what would be typical values and array size for the I64 input array. (And why would it be I64???)


You code seems wrong in so many places! With each iteration, you cast a 1byte string to U8, add it to a I16 number in a shift register, thus coercing it to I16 (why???), then display it in a I64 indicator (why???). What length do you expect the output string to be?

That index array and typecast could be replaced by simple math.


Do you have an example for an input array and correct result?

0 Kudos
Message 4 of 5

Form a wild guess, your input array contains the position of bits to set in an U8 numeric. So if it contains the number 1..8, we get 255 (FF) that can be cast to a binary string with one element or formatted into a hex string (two characters, each 0..F exclusively).


Here are both possibilities. You need to see what you instrument really wants:




Message 5 of 5