12-02-2015 11:03 AM
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()?
12-03-2015 02:35 PM
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
12-03-2015 03:02 PM - edited 12-03-2015 03:02 PM
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.