LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write to Measurement File does not work with analog data.

Hi,

 

I am trying to aquire data from NI9211 DAQ Unit via USB and record that data to a file with a timestamp. I have tried all I could think of and came up with this. somewhere on the way my signal is being lost and I have no idea where. I am not sure if I need to use shift registers but I want to output the data in the loop after time out. Thank you so much.

0 Kudos
Message 1 of 7
(2,632 Views)

You have some fundamental flaws in your program. First of all, you are not acquiring data with any timestamps. It does no good to convert to dynamic data - garbage in, garbage out. Second, you are using the insert into array on an empty array. That does not work either. Inserting an element into an empty array results in an empty array. You could have seen that if you had used a probe on the shift register.

 

Attached is a modified version. It acquires data as a waveform data type so that there are timestamps. It then uses a build array function so that a new acquisition is appended to the old. Cleaned up your messy diagram as well.

Message Edited by Dennis Knutson on 12-08-2009 08:27 PM
0 Kudos
Message 2 of 7
(2,624 Views)

Dennis,

 

I am sorry for my poor understanding of NI but I am trying. The VI you modified works, however the loop stops after the time target but not the VI and it never asks for a file name and therefore it does not output any file. Thanks!

 

Boris M.

0 Kudos
Message 3 of 7
(2,616 Views)
The VI will work and woutput the file if in Highlight mode!
0 Kudos
Message 4 of 7
(2,607 Views)

Yes, you're right. Sorry, the waveform datatype got me messed up as well.

 

Your current VI has a single channel. If that is what you are using, then the DAQmx Read can be changed to a 1Ch acquisition which will return a waveform and not a 1D waveform array. You can then replace the Build Array with the Append Waveform function. If you need multiple channels, that will take a little more work. I don't have time right now, though to provide that example.

0 Kudos
Message 5 of 7
(2,604 Views)

I need to have the functionality to select 1 or more channels to log. I would really appreciate your help on this. Thank you so much.

 

 

Boris M.

0 Kudos
Message 6 of 7
(2,580 Views)
When I wire a constant to the number of samples to read (i.e. 4), it seems to work just fine.
0 Kudos
Message 7 of 7
(2,567 Views)