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

Hi Tusharvp,

 

I would read the data stream and search for the (complete) "start of data" message (hex "FEFC 0101 0101 FD"). Once you found it you know you are in sync with your data stream and now you can parse the next messages (as has been shown by crossrulz).

 


@Tusharvp4 wrote:

I have a problem only in 0.25 second speed measurement in above VI..


Which baudrate do you use with your device?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 21 of 39
(1,073 Views)

My instrument is running on baud-rate 115200...I am receiving whole message without losing any byte on hyper-terminal at 0.25 second...But having issue with last VI..

 

How to 'start of message'..!! can you please modify in VI...??

 

However I am receiving 595 bytes in single message..Here I am displaying only 16 parameters..

0 Kudos
Message 22 of 39
(1,068 Views)

Hi Tusharvp,

 


@Tusharvp4 wrote:

My instrument is running on baud-rate 115200...I am receiving whole message without losing any byte on hyper-terminal at 0.25 second...


At 115200 baud it takes ~52ms to transfer the whole data of ~600 bytes, so your VI should be able to handle the data.

 


@Tusharvp4 wrote:

How to 'start of message'..!! can you please modify in VI...??


Read the data, collect it in a shift register. Search for the "start of data" message, as described in your protocol description.

The data behind that "start of data" message can easily be parsed as now you are "in sync" with your data stream.

 


@Tusharvp4 wrote:

However I am receiving 595 bytes in single message..Here I am displaying only 16 parameters..


Because you don't parse the full data set, but only 18 data "subsets"…

Each message "subset" contains the parameter number, so use this to place the decoded value into the corresponding element of an array holding all 82 parameter values!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 23 of 39
(1,062 Views)

@Crossrulz and @Gerwd..

Thank you for amazing support...!!

 

@Gerwd...I did not understand yours last suggestion enough properly...Can you please little help me out through raw arrangement of NEW VI that your are suggesting me..

0 Kudos
Message 24 of 39
(1,033 Views)

Hi Tusharvp,

 

this is showing the concept:

I would probably use a consumer-producer scheme and add more checks to be sure to have the data stream always "in sync"…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 25 of 39
(1,022 Views)

How did you write string constant of "FEFC 0101 0101 FD"...?? 

0 Kudos
Message 26 of 39
(1,011 Views)

@Tusharvp4 wrote:

How did you write string constant of "FEFC 0101 0101 FD"...?? 


Right-click on he string constant.  Select Visible Items->Display Style.  You should see a little 'n' appear on the left side of the constant.  Click it and select "Hex Display".  You will now see the bytes in the string in a hexidecimal format.


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 27 of 39
(1,000 Views)

Oh sorry...I was considering x as cross...I thought that it is something new..

 

 

 

0 Kudos
Message 28 of 39
(996 Views)

@GerdW wrote:

this is showing the concept:


In the past, I ran into major memory issues when trying to parse large strings to handle serial protocols.  So I started reading only what I needed to in order to find the sync byte(s)/frame.  So I would go with something more like this.


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
Download All
0 Kudos
Message 29 of 39
(988 Views)

 

@crossrulz

 

Thank you....!! Sir

 

I tried yours VI...

 

But having issue with 0.25 second speed measurement...

 

Error-1073807253 (Hex 0xBFFF006B) A framing error occurred during transfer...

 

0 Kudos
Message 30 of 39
(978 Views)