Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

BeginWriteMultiSample not working

Hi,

 

I have a PCI-6052E and I am using C# with DAQmx 15.1. I am trying to ouput 4 voltage values from ananlog output 0, and when the task is done, invode a callback function. My code is as below:

 

 

analogOut = new Task("ao");
analogOut.AOChannels.CreateVoltageChannel("Dev1/ao0", "", -10, 10, AOVoltageUnits.Volts);
analogOut.Timing.ConfigureSampleClock("",
   20,
   SampleClockActiveEdge.Rising,
   SampleQuantityMode.FiniteSamples,
   4);

analogOut.Control(TaskAction.Verify);

analogOutArray = new double[4] { 0, 5, -5, 0 };

analogWriter = new AnalogSingleChannelWriter(analogOut.Stream);
analogWriter.SynchronizeCallbacks = false;
analogWriter.BeginWriteMultiSample(false, analogOutArray, null, null);

analogOut.Start();      

 

The problem I have is there is no voltage output at all. (There is no callback function within BeginWriteMultiSample because I want to try the simpliest example first. When I insert a callback function there, the callback could be called without any issue, but still no voltage output.)

 

If I use WriteMultiSample() instead of BeginWriteMultiSample(), the voltages can be gererated correctly. Does that mean my card doesn't not support BeginWriteMultiSample()?

0 Kudos
Message 1 of 3
(4,187 Views)

Take a look at this KB. You may have to implement a "Task.WaitUntilDone", to keep it from returning and attempting a new write operation.

 

http://digital.ni.com/public.nsf/allkb/BD2A68EE9110FDEC86256F0A00579023

0 Kudos
Message 2 of 3
(4,163 Views)

Thanks for the reply.

I tried that by attaching a callback function to BeginWriteMultiSample. The callback function is actually being called, but either with our without placing Task.WaitUntilDone within the callback function, there is still no ouput. Something worth mentioning is when Task.WaitUntilDone is there, my application window would just hang and doen's respond.

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