LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Acquired data is wrong amplitude

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!

0 Kudos
Message 1 of 11
(3,390 Views)

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.

Message 2 of 11
(3,383 Views)

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.

0 Kudos
Message 3 of 11
(3,377 Views)

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

CTA, CLA, MTFBWY
0 Kudos
Message 4 of 11
(3,372 Views)

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. 

Message Edited by Dennis Knutson on 09-10-2008 08:07 PM
Message 5 of 11
(3,365 Views)

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!

Message Edited by altenbach on 09-10-2008 10:24 PM
Message 6 of 11
(3,348 Views)

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..*  Smiley Very Happy

0 Kudos
Message 7 of 11
(3,319 Views)

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.. 😞

0 Kudos
Message 8 of 11
(3,310 Views)

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.

Message 9 of 11
(3,300 Views)
For the function you are using, yes you need a waveform data type in order for the correct spectrum to be displayed. You can use the Build Waveform function to create a waveform data type but do you want to manually enter the dt value? If someone else uses the read program, how will they know what the sample rate is? It would be far better to save the actual dt value in your file, read it, and then create the waveform data type. Look at the shipping example called Cont Acq&Graph Voltage-To file Binary. In there, a header file is created that contains all of the necessary information to recreate the acquired signal. The Graph Acquired Binary Data shows how to read the header.
Message 10 of 11
(3,297 Views)