From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

need help with hex data extraction and manipulation

Solved!
Go to solution

Hi,

 

I have successfully able to transmit hex commands over serial port to my device and receive the replies in hex from it. I was able to confirm this by changing the display format to hex for the control and indicator. Now I want to store portion of the received hex data and use it in my next commands. Example of received data as below:

 

F00D 0010 1100 0001 E002 2C4D 6C93 4D7E AA66

 

The blocks in red will be incorporated in next command so that when I sent this command it will look like this:

 

F00D 0014 2000 0003 E002 2C4D 6C93 4D7E 0000 0020 77AF

 

In summary, send command and get reply, extract and store data blocks in red, then send different command containing the data that is stored. Everything is in hex format. Question is how can I extract/store the wanted bytes and later reconstruct a hex command containing those bytes? Should I convert to normal string, byte array, or hex array? If the last 2 conversion methods are used, I need to ensure that the zeros are not lost.

 

I have attached my VI. Please have a look and help to provide solution.

 

Thanks in advance.

0 Kudos
Message 1 of 4
(2,423 Views)

It IS a normal string, just with mostly unprintable characters, so plain string operations (string subset, etc) should work just fine.

0 Kudos
Message 2 of 4
(2,418 Views)
Solution
Accepted by topic author yamasce

Here;s what I had in mind (LabVIEW 2010):

 

 

Download All
0 Kudos
Message 3 of 4
(2,413 Views)

ok i thought hex string will be handled differently. anyway thanks for your prompt replies.

0 Kudos
Message 4 of 4
(2,395 Views)