LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert U16 to scaled data

Vr2 appears to be inside the 0 case. That means that the value will be used on the first iteration of the loop, but for all other iterations a value from some other case which is not visible in the picture will be used. This is fundamental to the way case structures work.

Lynn
0 Kudos
Message 11 of 15
(1,165 Views)
I can understand that you would want to write the integer out to a file as an I16 to save file space.  But you are really hurting yourself on resolution.  You are take a U16 then multiplying it by 0.0062  (at least for this one channel).  Then it is being coerced (see the dot on write to file function at top) to an I16.  Multiply by .0062 is the same as dividing by 161.  That is larger than dividing by 128 which means you are losing more than 7 bits of resolution by doing this.  You are going from 16 bits of resolution in the unsigned integer to effectively only 9 bits once you have multiplied in the conversion factor.
 
Why not just write the whole U16 out to the file as a U16.  You can store the conversion factors for each channel in a separate file for reference later.  This way you can keep your binary file small, still keep all of your resolution, and by refering to the separate file for the conversion factor, you can do the math later on to get the scaled values.
 
By the way, where did you get that function for write to file with the I16 input?  I don't see that on any of my programming palettes.
Message 12 of 15
(1,149 Views)

just a tought...

you have an analog value, probably between 0-10. then why not simply multiply the scaled function by 4.5  orders of magnitude (use the whole 16 bits of the unsigned info). then you keep all the relevent information, whithout having to use extended or double precision.

 

-----------------------------------------------------------------------------------------------------
... And here's where I keep assorted lengths of wires...
0 Kudos
Message 13 of 15
(1,140 Views)

Thanks everyone.


Ravens Fan,

The function for write to file with the I16 input that I’m using is on the picture attached. Actually, I don't know if it’s the best function to write to file, but I know it keeps it light (save file space). Do you know a better way to do it?

I appreciate the help!

Download All
0 Kudos
Message 14 of 15
(1,126 Views)
I had just never seen a function that looked like that one before.  I just don't see it on any of my palettes.  Is it part of a toolkit?  Something you wrote or something you downloaded?
 
The other function that might work for you is write to binary file.  Here you write the data directly into the VI.  If the data is a I16 or U16 format it would be 2 bytes per datum.  You can wire in an entire array.  It will add some array size info to the front of the data unless you wire a false to the "prepend array size" input.

Message Edited by Ravens Fan on 05-07-2007 12:01 PM

0 Kudos
Message 15 of 15
(1,120 Views)