09-10-2008 06:37 PM
Hi everybody,
Has anyone of you experienced data acquisition using NI A/D converters and then reading the data back from saved data acquisition bin files to get the wrong data?? It seems like that is happening to me.. I know my bin file data is way less than 1, but the waveform is outputting ~10^9 .. I'm guessing it is just an scaling problem? Is there a clean way to correct this without having to scale manually?
Thanks!
09-10-2008 07:30 PM
Is the scaling correct before you save the data? How did you write the data to file and how are you reading it back?
Could it be you are using the wrong byte order or representation?
Can you attach a small example data file and tell us what data you expect.
09-10-2008 08:38 PM
The scaling is correct before the data was saved. It is written in big-endian, network order with 32 bits single precision. I've checked this with matlab and it opens fine (data is much less than 1).
I wrote the data to the file just like the labview example Write to Binary File: labview\examples\file\smplfile.llb\Write Binary File.vi and reading it back, I used the labview example Reading from Binary Files: labview\examples\file\smplfile.llb with Data Size (in bytes)=4.
I don't know where is going wrong.. attached is .vi file and a data file. You're help is much appreciated.
09-10-2008 08:44 PM
Why not just save the data as ASCII text? You can then look at it in notepad and verify that the values are the same. Just pass the data into a Format Into String VI and then write it to file in your loop instead of using binary. Binary is usually only needed when streaming data to disk at high rates >60MB/sec.
-snow
09-10-2008 09:03 PM - edited 09-10-2008 09:07 PM
Your comments do not match your program. You said you saved the data just like the example - "32 bits single precision." except the example saves DBL and then your file read is set to read I32 integers - again not like the read example you cite. What color is the wire going to the Write to Binary File? Is it the same as the color in your file read? If they are different, that should be a big clue as to what is wrong.
p.s. Your use of the Power Spectrum function is flawed at a very basic level. You are passing only an array - not a waveform data type that contains a dt value.
09-11-2008 12:22 AM - edited 09-11-2008 12:24 AM
Jud~ wrote:It is written in big-endian, network order with 32 bits single precision.
OK, all you need to do is change the representation of the diagram constant to SGL and everything will fall into place. 😄
(right-click...representation...SGL) A one-click fix!
09-11-2008 12:43 PM
Ohh.. I see. Thank you so much for your guys inputs..
*I'm still a newbie when it comes to labview; must strive to be as great as you guys..*
09-11-2008 01:12 PM
Dennis,
So for power spectrums, is it required to have a .WDT file? Is there any other way.. ie specifying the dt value somehow? Thanks!! I've been looking at the examples on power spectrums, but with no luck so far for my particular case.. 😞
09-11-2008 01:40 PM
Jud~ wrote:So for power spectrums, is it required to have a .WDT file? Is there any other way.. ie specifying the dt value somehow? Thanks!! I've been looking at the examples on power spectrums, but with no luck so far for my particular case.. 😞
You are not using any of the fancy options of the WDT version anyway (averaging, widonwing, etc)
You should use the old-fashioned "auto power spectrum" and wire dt. it will give you the power spectrum and df, which you then can wire to the "increment" property of the x axis.
09-11-2008 01:47 PM