Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Populate data in AnalogWaveform

Hi folks,

 

I'm very new to programming with NI Measurement Studio....so this maybe a very cheap mistake, but it already took my hours to find

a lot of way how to don't do it 😉

 

My code (which was produced by Measurement Studio and the DAQmx assistant) looks like this:

 

                NationalInstruments.AnalogWaveform<double>[] generatedData = new NationalInstruments.AnalogWaveform<double>[daqTaskComponent1.NumberOfChannelsToWrite];


                // TODO: Populate data to write.
                //throw new System.NotImplementedException("You must populate the data to write before writing the data.");

                generatedData[0].Samples[0].Value = 0;
     
                daqTaskComponent1.WriteAsync(generatedData);
                waveformGraph1.PlotWaveforms(generatedData);

 

The problem is, I think the init of generatedData is linked to the output channel, but although

I stated 100 Samples to write, the SampleCount (generatedData[0].SampleCount) is NULL.

 

I just don't know how to add samples to this object.

 

Thanks in advance for any hint.

 

Best regards,

Gregor

0 Kudos
Message 1 of 2
(4,065 Views)

Hi Gregor,

 

it might be better to work through the NI-DAQ Examples. They are very well documented and might give you a good overview. Unfortunately, the DAQmx assistant is a bit tricky to handle.

 

The folder where you can find the examples would be the following (in Windows 7):

C:\Users\Public\Documents\National Instruments\NI-DAQ\Examples\DotNET4.0\Analog Out\Generate Voltage\GenMultVoltUpdates_IntClk\CS

 

Please have a look at one of these; if there are still questions, please ask.


Have a great day,

 

Stefan

 

---

 

Stefan Egeler

Application Engineer

National Instruments Germany

 

0 Kudos
Message 2 of 2
(4,035 Views)