Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Experiencing lag when viewing and saving waveforms

I'm working on an application that will be somewhat interactive with a user.  The main purpose of the application is to measure and analyze human response to a given stimuli.  The goal of the application is to create a sinusoidal waveform, that will be used as a goal pattern that the user will need to match.  Then using the DAQ and a already built apparatus, the user should attempt to follow the goal waveform as best as possible, ie. attempt to recreate the waveform by using the apparatus.  We have been able to design all the components of the system, when we just show both the goal and user created waveform in a waveform chart, however, when I add in a write to binary file sequence into the while loop, the waveform acquired from the user becomes heavily delayed. I have tried using different file writing techniques and to different types, but there is still lag.  I've been stuck on this for a few days, and thought that I might be able to get a little bit of help in trying to figure out how to optimize the application to remove this lag period, because it screws up the data collection process, and if we can't save the data, then we have no way to analyze it after the experiment.
The way the application is setup now is by using the DAQ Assistant express vi, because I was having trouble collecting the information not using the DAQ assistant as one example I saw showed. Basically, I would like to know whats the fastest and most efficient way to continuously read information from the DAQ, display it on the Monitor, and store it in a binary data file. 
 
Any insights would be greatly appreciated, and Thanks in Advance for any help you provide.
0 Kudos
Message 1 of 4
(3,302 Views)
Hi Petrie,

I want to start off by giving you a link to a great article we provide about streaming data to and from disk.  This article can be found here.  Typically, the major limiting factor when streaming to disk is the hard drive speed.  This article talks about various types of hard disk setups (ATA, IDE, EIDE, SATA, and Raid arrays) and how they can be used to stream data to disk efficiently.  If you're using one of our M-series or E-series devices, you should have no problem reaching speeds fast enough to stream to disk.  I would highly recommend trying our shipping example that streams to a binary file.  The example is called Cont Acq&Graph Voltage-To File(Binary).vi (Help » Find Examples » Hardware Input and Output » DAQmx » Analog Measurements » Voltage).  This example is an efficient way of taking an analog measurement and streaming it to a binary file on disk.  The way the example works is that it breaks up the initiation for both the binary file and the DAQmx task so that the only two things that occur during the while loop is the actual DAQmx read (which grabs the data from the PC memory) and the actual writing to binary file.  Also, pay close attention to the note in the example which states, "This example uses unscaled I32 reads.  Some devices support unscaled reads in smaller widths, such as I16.  To get the maximum performance out of your device, use the unscaled read with the smallest supported width."  I would recommend doing this as well to increase performance.

I hope this helps,
Paul C.

Message Edited by Paul C. on 09-13-2007 11:48 AM

0 Kudos
Message 2 of 4
(3,293 Views)
I tried that example that you gave me, but I was not acquiring any data from the the PCI-6221 (37 PIN) DAQ.  I wanted to see if you had any idea on why I would be able to acquire the correct data using the DAQ Assistant, but not using the examples provided.  My first hypothesis about it is that using the DAQ Assistant, the system is configured to use an NRSE Terminal Configuration, and I wasn't sure if thats how the example was configured, and I wasn't able to locate anything in the example that indicated where it was getting its voltage reading.  If anyone has had a similar experience, and was able to solve the problem, I think this implementation is what I am looking for, but as of now its not very useful since I'm not able to gather data from the DAQ at all.

Thanks for any help.

Petrie
0 Kudos
Message 3 of 4
(3,238 Views)
Nevermind, I found that you need to add in a property node into the configuration of the signal and just have that get set to NRSE.  The property node is in the DAQnm Advanced Tab for anywho else who was having a similar issue.  And with that node, you can also scale and make other modifications to the DAQ setup by adding new properies to the node.

0 Kudos
Message 4 of 4
(3,235 Views)