LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Data acquistion after output with double buffer

Is there a way to acquire data that is being output by a double buffer? The code for double buffer is shown below. The way I am getting the data to the input channel is by wiring the input channel with the output channel. Once I have the data already in the input channel, how can I acquire it with CVI?

Thanks.
0 Kudos
Message 1 of 11
(3,883 Views)
Hello,

Try looking at the shipping example "DAQdoubleBuf.C" at: C:\Program Files\National Instruments\CVI71\samples\daq\Ai. It demonstrates how to acquire data from an AI channel.

Please let me know if you have any further questions.

Regards,
Sean C.
0 Kudos
Message 2 of 11
(3,876 Views)
Hi, Sean. I've looked at the "DAQdoubleBuf.c" example with AI and merged it with my code. So now I am supposed to output the data and acquire the input. I have attached the modified code. However, there is a problem when I run the program. when I iterate through the loop "while ((iLoopCount < iHalfBufsToWrite) && (iStatus == 0))", which outputs the data, a run time error is thrown by the "WFM_DB_Transfer" function:

" NON-FATAL RUN-TIME ERROR: "WFMdoubleBuf.C", line 207, col 27, thread id 0x00000544: Function WFM_DB_Transfer: (return value == -10608 [0xffffd690]). noTransferInProgError: No transfer is in progress for the specified resource."

This happens only after I merged the codes for AI and AO.
0 Kudos
Message 3 of 11
(3,856 Views)
Hello,

I was able to reproduce your error. You are right, when I comment out all of the AI code, the AO works just fine. I will continue to look into this and let you know when I have some results.

Regards,
Sean C.
0 Kudos
Message 4 of 11
(3,840 Views)
Thanks Sean.
0 Kudos
Message 5 of 11
(3,816 Views)
Hello,

You might be having problems because you are configuring and starting your AO, and then configuring and starting your AI.
Take a look at the following example which demonstrates how to synchronize AI and AO.

http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B45EACE3E72F56A4E034080020E74861&p_node=201223

Let me know if you have any further questions.

Regards,
Sean C.
0 Kudos
Message 6 of 11
(3,809 Views)
Hi Sean, I ran the code and the WFM_DB_HalfReady function threw this error:

" NON-FATAL RUN-TIME ERROR: "AIAO_Sychronize.c", line 141, col 18, thread id 0x00000434: Function WFM_DB_HalfReady: (return value == -10608 [0xffffd690]). noTransferInProgError: No transfer is in progress for the specified resource."

Right after the "SCAN_Start" function I can see on the oscilloscope that 2 waveforms with 2 cycles are output. But then as soon as it enters the while loop the "WFM_DB_HalfReady" function throws the error.

Message Edited by vtech on 06-07-2005 11:49 AM

0 Kudos
Message 7 of 11
(3,796 Views)
Hello,

The following KB offers a solution to error -10608: http://digital.ni.com/public.nsf/websearch/37752A79EB6A950886256C8B006E8870?OpenDocument .

Try turning the regeneration option to ON. To do this use the WFM_DB_Config() function. See the attached image.

If this does not help, try reducing the sample rate. Let me know if you continue to have problems with this.

Regards,
Sean C.
0 Kudos
Message 8 of 11
(3,783 Views)
Thanks for the tip Sean. I was able to run the program without the error occuring.

Is there a way to increase the number of output points? Initially the code only had 1000 output points. But anything over 12000 points will create stack overflow. I was looking at another similar example here: ftp://ftp.ni.com/contrib/epd/B45EACE3E6B856A4E034080020E74861/AO_Change_Freq_and_Amp.zip
and they use 800000 points for their buffers.
0 Kudos
Message 9 of 11
(3,774 Views)
Hi,

The following Knowledge Base describes the error you are seeing: http://digital.ni.com/public.nsf/websearch/9366D2132D82A24586256A120000E57B?OpenDocument .
I was able to eliminate this error by declaring the buffer arrays as static. See the attached image.

Let me know if this does not help.

Regards,
Sean C.
0 Kudos
Message 10 of 11
(3,750 Views)