Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

AnalogWaveform plotting example

Solved!
Go to solution
I'm looking from some examples on how to display the data type analogwaveform on a waveform graph.  I have looked at the examples in National Instruments\MeasurementStudioVS2005\DotNET\Examples\Application but none of them use the analogwaveform data type.  The examples in that dir use a much simpler example where the data in in an array of double.  Are there any example of how to work with the analogwaveform type?


0 Kudos
Message 1 of 7
(12,882 Views)
Solution
Accepted by topic author Steve_InMA

Hi Steve_InMA,

There is several examples in the
<MeasurementStudioVS2005\DotNet\Examples directory that use this AnalogWaveform data type. For example the, PlotWaveform example under the UI\WindowsForms\Graph directory uses this data type along with some of the DAQmxWithUI examples like AnalogDataFileProcessor, GlobalContinuousAO, SpectrumAnalyzer, etc.

The tip that I use to find if there is an example that incorporates some function or data type is to do a Ctrl+F on the examples directory, search using "All files and folders",  then type in the name of the function or data type into the "A word or phrase in the file" field. This works really well.

Hope this helps!

Best Regards,

Jonathan N.
National Instruments
Message 2 of 7
(12,870 Views)
Hello,

I would like to use some AnalogWaveform<> to acquire my data with time stamps, but I can't find any example describing how to extract the data in these objects. My application is a multi channel continuous acquisition. Here is a piece of my program:

private void startButton_Click(object sender, System.EventArgs e)
{
    //Create the virtual channels to poll
    myTask.AIChannels.CreateVoltageChannel(SelectedChannels, "Acq1",
    AITerminalConfiguration.Nrse, Convert.ToDouble(minimumValueNumeric.Value),
    Convert.ToDouble(maximumValueNumeric.Value), AIVoltageUnits.Volts);

    //Configure the timing parameters
    myTask.Timing.ConfigureSampleClock("", Convert.ToDouble(rateNumeric.Value),
    SampleClockActiveEdge.Rising, SampleQuantityMode.ContinuousSamples, (int)samplesPerChannelNumeric.Value);

    //Verify the Task
    myTask.Control(TaskAction.Verify);

    //Declare the reader
    analogInReader= new AnalogMultiChannelReader(myTask.Stream);

    //Enable a callback function to have access to the acquired data
     analogInReader.SynchronizeCallbacks = true;
    analogCallback = new AsyncCallback(AnalogInCallback);
    analogInReader.BeginReadWaveform(samples, analogCallback, myTask);
}

private void AnalogInCallback(IAsyncResult ar)
{
    AnalogWaveform<double>[] test = new AnalogWaveform<double>[100];
    //Copy  the acquired data to the test[] array
    test = analogInReader.EndReadWaveform(ar);
}


Now, in the callback function I'd like to have access to the time and voltage data acquired and stored in test[], how can I do that?
If you have no idea, is there another way to get time stamped data from the NI-DAQ?

Thanks for your help,
Adrien
Message 3 of 7
(12,628 Views)

Hi,

 

DAQmx does not include timestamps in its acquisition – it uses the number of samples collected as the independent variable in an acquisition.  Instead, use system calls to retrieve the timing information for the first sample.  You can then use the time period between samples (1 / sample rate) to determine the relative timing information for future data.

 

Please post back if you have further questions.

 

Regards,

 

Ed W.

Applications Engineer

National Instruments

0 Kudos
Message 4 of 7
(12,608 Views)

Can someone explain to me how to retrive the data out of type analog waveform? I want to do a contiuous read on multiple channels and put the voltage data in a csv xml file. How do I get the voltage data from the analog waveform?

0 Kudos
Message 5 of 7
(11,487 Views)

talltubatom,

 

A waveform is a compilation of time (dt) and amplitude (y) data.  You can extract each of these components from their waveform "shell" by using the "Get Waveform Components.VI" which can be found on the Programming>>Signal Processing Pallette.  This will allow you to get any of y, dt, t0, or Attributes components of the waveform.

 

If you have any other more detailed or application related problems I suggest you create a new thread so that we can stay better organized on our end and so that you can more easily get help from the other members of our forum. 

Sincerely,
Jason Daming
Applications Engineer
National Instruments
http://www.ni.com/support
Message 6 of 7
(11,468 Views)
I am sorry to post on the wrong thread. Why I am posting introduction here? I could not found the introduction thread. I just joined this community and do not want to go out without posting any comments. I have decided to become the permananet member of this useful community. My name is jack and I work in a wireless internet company in New York. I am studying master of computer sciences. 
mcse test
0 Kudos
Message 7 of 7
(9,898 Views)