02-05-2007 10:59 AM
02-05-2007 11:49 AM
Let's backup a bit. If you simply have a two byte string of binary data that represents a signed integer, you should simply type cast is as I16.
Unfortunately, you seem to complicate things quite a bit even though most of the early code is not visible in your image. You seem to create a binary formatted string with 16 digits, but then you read it as a binary string with 32 digits, meaning it'll swallow the sign bit as part of the 32 bit number. I also don't understand why you would use a DBL indicator to display a signed integer.
Can you attach a simple VI that contains your raw string as a diagram constant and tell us what altitude value you expect from it.
Most likely, the entire parsing of all values in the entire raw binary string can be done in very few simple steps. 🙂
02-05-2007 12:00 PM - edited 02-05-2007 12:00 PM
Message Edited by jbutera on 02-05-2007 12:01 PM
02-05-2007 01:42 PM
Using LV 8.2.
I just tried some suggestions from off the discussions groups regarding handling serial inputs.
Your suggestions appear to have great merit and are much simplier.
I'll give them a go.
Thanks.
02-05-2007 04:11 PM - edited 02-05-2007 04:11 PM
I still have the feeling that you are doing this way too complicated. Why do you even go through the detour of converting the original data string into a byte array, then slice out the segments and cast everything seperately.
If you have fixed fields in your string, all this can be done much easier and you get all data contained in the string with one simple operation.
The attached VI (LabVIEW 8.0) shows a simple demo. On the left, we synthetically and explicitely create a binary string from three integer numbers (I16, U8, I32) and reverse the byte order for little endian if desired.
The string display (hex display) shows the raw data.
To get all data back out in one operation, we can simply define a cluster that contains the names and correct datatype in the correct order and use it as type input for the unflatten operation. (sorry, the diagram has some typos, I only spend a few minutes on this ;))
Message Edited by altenbach on 02-05-2007 02:12 PM