ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parsing Data for SPS30 Particle Sensor

Solved!
Go to solution

Hi all,

 

I have been trying to parse the incoming data from my SPS30 particle sensor. I can read the data just fine, but I am having trouble with the output format. The hex data values represent the mass concentration, and in the data sheet there is a table that shows what byte represents each particle size. I cannot figure out how to extract the data and output it in a way where it makes sense. Maybe I can just send the raw data into an excel file and then parse it there? I am not sure. Please let me know if i am not being clear.

Thank you!

 

Dvlasenko_0-1608226481898.png

 

0 Kudos
Message 1 of 5
(2,727 Views)

Seems pretty simple.  Your data is an array of bytes.  (It looks like a string to LabVIEW, but isn't that what a string is - an array of bytes?)  So you can split the string into sets of characters (either 2 or 4 character sets as appropriate) and typecast it to whatever data type is appropriate - i.e., U16 or single float.

 

What you are telling LabVIEW to do is "Look at the 2 character string and interpret the 2 bytes as a U16 instead".

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 5
(2,704 Views)

Hi,

Thank you for your response. How do I split the string into sets of characters? Having trouble with that.

 

Thanks

0 Kudos
Message 3 of 5
(2,643 Views)
Solution
Accepted by topic author Dvlasenko

Something like this:

parsing.png

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 4 of 5
(2,635 Views)

Thank you for solving this issue. 

 

Did you have the VI associated ? 

 

Thanks a lot in advance, 

 

best regards, 

 

 

0 Kudos
Message 5 of 5
(2,228 Views)