Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

asynchronously writing and callback function

hi everybody,
 
i am working on an asynchronous write operation as described in
'Asynchronously Reading and Writing with the NI-DAQmx Visual C++ Class Library'
 
in the Visual Studio .NET documentation.
 
I've worked with asynchronous read functions and callbacks (the OnEvent function in this example) before, and it worked
well.
Atm i am doing output to 16 digital outputs on my PCI6259 card. I want to output a waveform stored in a vector containing about 1000 samples.
So i installed the event handler for my writer object, and started the output by calling
'WriteMultiSamplePortAsync'.
 
The problem is, that the callback function 'OnEvent' is called after the first sample of my vector is sent, and not after the complete vector.
i need to know when my whole buffer is through, because i have to recalculate it and send it again...
 
Anyone has an idea where the problem is?
 
Thx in advance
 
markus
0 Kudos
Message 1 of 3
(3,461 Views)
As it is not clear what exactly you are doiing in your software, would it be possible to attach aexample, or at least paste in the essential code?
0 Kudos
Message 2 of 3
(3,436 Views)
Well i've attached a somehow simplified code of my problem.
 
First i start two tasks, one counter, which acts as sample clock for my digital output, and the digital output task itself.
In this example i use a output frequency of 100kHz.
 
Then an event handler for my digital write operation is installed.
Next, i create a vector with size 1000, fill it with some data and write it out calling 'WriteMultiSamplePortAsync'
 
What i would expect now, is that the OnEvent-function is called, as soon as all of the 1000 samples of my output vector have been sent.
But what really happens is that OnEvent is called after the first of the 1000 samples has been written.
 
As i said before, the same procedure works fine with analog input tasks.
 
Regards
Markus
 
 
0 Kudos
Message 3 of 3
(3,424 Views)