LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert long hex string to individual decimal values..??

Solved!
Go to solution
Highlighted

I am stuck in conversion 

0 Kudos
Message 1 of 39
(752 Views)
Highlighted

Can you give an example of your hex string, along with the desired output?

Perhaps just the first few values is enough, so we can see the format and the desired output behaviour.

 

Ideally, also include what you've tried so far (since you said you're stuck).


GCentral
0 Kudos
Message 2 of 39
(750 Views)
Highlighted

Hi Tushar,

 

generic answer to your generic question: use StringToU8Array to convert your string into individual "decimal" values…

 

As CButcher said: provide examples of your input string and the expected output values for those input examples!

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 3 of 39
(730 Views)
Highlighted

And to remove almost all doubt, it is best to create a VI with your example data as a default value of the input control as well as an indicator for the data type you want out and preferably some text stating what the output's value should be.


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 4 of 39
(711 Views)
Highlighted

@Tusharvp4 wrote:

I am stuck in conversion 


What a poor message.  That is like calling someone and saying your lost, and never bother telling them where you've been or where you are trying to go to.

 

I recommend reading http://www.catb.org/~esr/faqs/smart-questions.html

Message 5 of 39
(693 Views)
Highlighted

The term "hex string" is not defined, so we cannot answer the question without additional information. Same for "decimal values". Both are cosmetic descriptions that don't tell us anything about the underlying datatype.

 

What is your definition of "Hex string":

  • A string formatted as hexadecimal, containing only characters 0..F?
  • Any delimiters that separate individual number (space? comma?)
  • A binary string displayed in a string indicator set to hex display?
  • How many bytes/desired decimal?
  • Byte order?
  • How are the numeric value represented and how do we know when one ends and the next one begins?
  • ...???

What is your definition of "Decimal values":

  • An array of numerics of a given representation (which one?) where the indicator uses one of the decimal formats?
  • Are these integers?
  • A concatenated string containing all formatted decimal values (characters 0..9), possibly  separated by delimiters?
  • ...???

LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 6 of 39
(662 Views)
Highlighted

Thank you for replying..

Now I completed my project..

But at actual i am facing another problem.

 

I am reading data through serial port..But while reading those data...I am losing some bytes in sequentially..

I have been tried to configure a configure port with many online solution...

 

0 Kudos
Message 7 of 39
(466 Views)
Highlighted

Hi Tusharvp,

 

again you failed in providing information needed to help you!

 

Why don't you name the device you are communicating with?

Why don't you provide a manual describing the communication scheme/parameters of your device?

Why do you disable that TermChar?

Does the device really sends exactly 1000 bytes?

Why don't you handle errors (instead of just deleting them)?

Why is Baudrate a string control?

Why don't you use AutoCleanup?

Why don't you attach real code (instead of just an image of code)?

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 8 of 39
(443 Views)
Highlighted

 

 

Why don't you name the device you are communicating with..?

I am communicating RS-232 based Instrument..

 

Why don't you provide a manual describing the communication scheme/parameters of your device?

I am attaching protocol here

 

Why do you disable that TermChar..?

I put terminal character enables at false..& end to read property at None.. Is it correct to use..??

 

Does the device really sends exactly 1000 bytes?

Device is sending 595 bytes..But i am reading 1000 bytes...

 

Why don't you handle errors (instead of just deleting them)?

for running an instrument error free..

 

Why is Baudrate a string control?

Sorry..Baudrate not in string control..I am converting it in decimal too...

 

Why don't you use AutoCleanup?

Why don't you attach real code (instead of just an image of code)

Download All
0 Kudos
Message 9 of 39
(439 Views)
Highlighted

Hi Tusharvp,

 

according to your image each messages starts with 254/FE and ends with 253/FD: why don't you use a TermChar of FD when receiving data?

 


@Tusharvp4 wrote:

Why don't you provide a manual describing the communication scheme/parameters of your device?

I am attaching protocol here


You didn't attach the full protocol, just a small portion of it…

 


@Tusharvp4 wrote:

Why don't you handle errors (instead of just deleting them)?

for running an instrument error free..


You don't "run an instrument error free" when you just delete all errors…

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 10 of 39
(433 Views)