05-01-2009 04:22 PM
I use MeasurementStudio ofr VisualStudio.NET 2008 to collect a continuous acquisition at 20kHz (NI-6009). I use the DAQ assistant to create a task that returns the data every 500ms. I use GetData to return a waveform. But every time I plot the trace, there is a 0.15V offset for the first very milliseconds, then the data is correct. It looks like noise, but if I speed up or slow down the acquisition, the "glitch" always follows the beginning of the returned data (from GetData method). I attached some pictures.
Here is the code from the DataReady Event
Private Sub AD_DataReady(ByVal sender As Object, ByVal e As DaqTaskComponentDataReadyEventArgs) Handles AD.DataReady
Dim d() As NationalInstruments.AnalogWaveform(Of Double)
d = e.GetData()
Me.WaveformGraph1.Plots(0).PlotWaveformAppend(d(0))
Me.WaveformGraph1.Plots(1).PlotWaveformAppend(d(1))
End Sub
05-04-2009 06:02 PM
Hey dualtronic,
Are you seeing the same "glitch" when you try running our DAQmx VB.NET examples? If you are creating a task in Measurement and Automation Explorer (MAX) and then using that task within your code, then the GlobalContinuousAI_USB example (which can be used for non-USB devices) should show the same behavior. You can find this example here: C:\Documents and Settings\All Users\Documents\National Instruments\MStudioVS2008\DotNET\Examples\DAQmxWithUI\GlobalContinuousAI_USB\vb
Try running this and see if the glitch still appears and if there are any noticable differences between your code and this example.
Lars
05-05-2009 03:08 PM
Hello Lars,
I tested the example application. It does NOT have the glitch. However, the example is hand-coded and does not use the Measurement Studio DAQ Assistant. Under the surface, the DAQ assistant auto-code uses a more complex data handling mechanism. I attached the project that shows the glitch. The only code I added is the DataReady event to display the data on a graph. You will need to have some type of ramping input voltage to see the glitch (otherwise it looks like noise). I believe that the data is being transposed somehow. The data at the end of the timespan is being put at the beginning, thereby showing up as a glitch in the signal.
Joe
07-05-2009 08:30 PM
Hi Joe,
I've been fiddling around with the auto-generated code for the DAQ Assistant (this nice thing with the DAQ Assistant is that it gives you all the code that it auto-generates, in a .cs/.vb file with the same name as the .mxb file and you can play around and tinker with it), and I believe I found out what is causing this...
If you look at the auto-generated code in your project (it is titled DAQTask1.vb), there is a line in there that actually starts the DAQ Read:
Reader.BeginMemoryOptimizedReadWaveform(DefaultNumberOfSamplesToRead, callback, state, data)
Change this to:
Reader.BeginReadWaveform(DefaultNumberOfSamplesToRead, callback, state)
and it should work....
It seems that there was some bug with the memory optimized read, I will be filing a bug report with our R&D department to root cause the issue.
Also, FYI, I personally add an event handled for the Closing event of the form and put the following line in there:
daqTaskComponent1.StopRead();
Doing this, you don't have to manually stop your task using the button/switch before closing your app!
Hopefully this should get you up and running for now! Let me know if you have any follow up questions.
07-13-2009 09:56 AM
Thank you Jervin! I was forced to abandon the DAQ Assistant for a long time. Now I can start using it again. Hopefully this bug will be resolved in the next NI-DAQ release.
-Joe Labataille