09-11-2014 03:10 PM
I'm acquiring 8 bytes of serial data and I would like to parse the data into 2 bytes of data so that I end up with 4 different temperature measurements. I tried many things that I found within the forum but I can't get it to work. The VI I attached is using the scan from string function but I'm not very familiar with this function. My defaulted my serial data so that you can see the data I'm receiving.
Thanks in advance for your help
Lowski
Solved! Go to Solution.
09-11-2014 03:19 PM
Do you know what the format of the data is supposed to be?
09-11-2014 03:22 PM
Yes the processor is spitting out data in binary (8 bytes) my output data will be displayed in decimal value
09-11-2014 03:24 PM - edited 09-11-2014 03:26 PM
Looks like 8 bytes of binary data. Try unflatten to an U16 (or I16) array and index the four elements.
Do you need to apply some scaling?
Is it little or big endian?
What range of temperatures do you expect from the default data in the current string indicator?
09-11-2014 03:28 PM
I'll give that a try...
Yes I do have to apply some scaling, it lil Endian, and I'm expecting to read temperatures upto 210C
09-11-2014 03:29 PM
Sorry I meant BIG Endian
09-11-2014 03:32 PM
See if this gets you started. You need to figure out the scaling yourself.
09-11-2014 03:48 PM
Thanks for your help altenbach! Yes this is exactly what I need...However I've applied my scale factors and I noticed that the I get the correct readings (~24-26C) for all three measurements but then I get really odd readings which tells me that I'm not synced at all. You probably noticed which I should of mentioned in the beginning, there is are 2 bytes of data at the end of the string (0xBEEF) that was added to use as a sync so that I know whats the next 2 bytes and so on are. How can I do this in LV.
Thanks again for your help!
lowski
09-11-2014 03:59 PM
Sorry, I don't do serial,....
You probably need to slow down the loop and query the number of bytes at port before reading. At what rate are the string arriving? Maybe you should just buffer the data and parse whenever your end of string marker is detected. I am sure somebody can give you more precise advice.
09-11-2014 04:02 PM
Thanks for the help! I think buffering my data and then parsing it is the way to go, I'll see what I can do
lowski