LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Hex String to Numeric conversion

Solved!
Go to solution

Hi Zain,

 

what i am stuck at is that I want to discard any packet that is not recieved fully that is most probably the last packet. but i dont know how to do it

Well, from your description I would guess, it could be a simple solution to check the length of your "packet" (whatever this might be)!

Best regards,
GerdW


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

Yeah that's true, But i want to develop a generic solution to this that i dont have to check the length every time i need to convert hex into bin

0 Kudos
Message 22 of 26
(1,097 Views)

@Zain23 wrote:

I am doing a hex to numeric conversion on the string that is 349000 bytes long. plus it is contains 24 byte packets along with header.....


349000 bytes is a tad too big string and another 24 byte packets ? Well I am not sure what the context is but I am sure you have some delimiters in the packet data to tell where it all starts and where it ends. ? A little bit more detail will help to understand the issue.

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 23 of 26
(1,093 Views)

Its 349KB string in which there are 24 byte packets. Every Packets starts with a header so I can start from header and pick 24 bytes but the last packet may not contain full 24 bytes because when data saving was stopped,  the packet may not be recived fully. When converting the data, i want to make sure to discard the half recieved packet and i want to make a logic to check and discard if any half recived paket is in the string

0 Kudos
Message 24 of 26
(1,085 Views)

Hi Zain,

 

when the only available check is the packet length you need to check it for each packet…

(Sometime there are checksums used, you might check them too.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 25 of 26
(1,077 Views)

If i have understood correctly your concern seems to be only on the integrity of the last packet that is received ( the user hit the STOP before it could be sent fully )

 

If so why not start checking the packets after a reverse sort wherein you check the integrity of the last packet first ? If the header contains no information on the cehcksum, then counting the bytes is the only option left or so i think.

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
Message 26 of 26
(1,068 Views)