01-04-2007 01:34 PM
private void AnalogInCallback(IAsyncResult ar)
{
try
{
if(taskRunning)
{
//Read the available data from the channels
data = analogInReader.EndReadMultiSample(ar);
//Plot your data here
dataToDataTable(data,ref dataTable);
analogInReader.BeginReadMultiSample(Convert.ToInt32(samplesPerChannelNumeric.Value),
analogCallback, null);
}
}
The error is
Some or all of the samples requested have not yet been acquired.
To wait for the samples to become available use a longer read timeout or read later in your program. To make the samples available sooner, increase the sample rate. If your task uses a start trigger, make sure that your start trigger is configured correctly. It is also possible that you configured the task for external timing, and no clock was supplied. If this is the case, supply an external clock.
Property:
NationalInstruments.DAQmx.DaqStream.ReadRelativeTo\n
Corresponding Value: NationalInstruments.DAQmx.ReadRelativeTo.CurrentReadPosition
Property:
NationalInstruments.DAQmx.DaqStream.ReadOffset
Corresponding Value:
Task Name: _unnamedTask<0>\n\nStatus Code: -200284
My question is:
Where is the error into the NI example? It seems that the callback routine is called but the buffer is empty or the buffer is in an overflow situation.
Best regards
Sergio garcia
01-05-2007 11:22 AM
01-05-2007 05:07 PM
Hello Brian.
Thank you for your fast reply.
The situation is quite "strange" because, using the examples compiled with VC++, I can use a sample
frequency of 1kHz and I can read 1000 samples without any problem.
In C# case (obviously the PC and the card are always the same), using the same parameters,
I cannot obtain same results.
Suppose I use 10 Hz as frequency rate and 10 samples per reads.
I think that every about 100 ms the callback is fired and I read inside the callback 10 samples
(or I am wrong?)
I modify the code of the example to record both the samples reads and the time elapsed
with respect to the previous callback.
callback nr. samples read time elapsed from previous callback [ms]
1 10 no meaning
2 10 93
3 10 78
4 10 93
5 10 78
6 10 93
7 10 78
8 10 1578
9 10 78
10 10 1656
11 10 78
12 10 1171
13 10 3828
14 10 78
15 10 15
16 10 78
17 10 7093
18 10 93
19 10 78
20 10 93
21 10 125
22 10 93
23 10 93
24 10 78
25 ERROR: SOME OR ALL THE SAMPLES REQUESTED HAVE NOT BEEN ACQUIRED YET
Question 1:
If the samples are not yet available, why the callback has been called?
Question 2:
Time elapsed between callback are "strange",
the samples read with analogInReader.EndReadMultiSample are right.
Consideration:
The frequency is very low, but the program does not work.
In my opinion the callback function has to be called ONLY when there are 10 samples into the buffer to read.
After some cycles I have the callback, but analogInReader cannot give me the samples required.
Can I suppose that the analogInReader.synchronizeCallbacks = true
(made in a different mode with respect to Framework 1.1) has some problem and the
callback function is not synchronized properly?
Could be? Can you suggest some adjustment to this part?
Please give me your opinion
Best regards
Sergio Garcia
01-09-2007 08:48 AM
Hello Sergio.
I have attempted to replicate your issue with the ContAcqVoltageSamples_IntClk C# example, but have been unsuccessful in doing so. I tried it in VS 2005 as well as Measurement Studio 2003 and both worked flawlessly. I tried the default acquisition rate of 1000 Hz and I also tried 10 Hz.
With this information, there must be something that differs in our system that is significant to the execution of the program. One thing that I am a little concerned about is the C# express compiler. Is there any way for you to obtain and compile the code in a basic VS 2005 compiler? Can you try another machine with the C# express compiler to test if it is an issue specific to that computer? Let me know how these tests go. I will continue investigating if the express compiler is an issue.
Have a great day!
Brian F
Applications Engineer
National Instruments
03-16-2007 05:24 AM
Hello,
When I try to execute DigFreq-Buff-Cont-LargeRange2Ctr.c example with a PCI6602 card, I have exactly the same error message with the DAQmxReadCountF64 function.
/*********************************************/
// DAQmx Configure Code
/*********************************************/
DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
DAQmxErrChk (DAQmxCreateCIFreqChan(taskHandle,"PCI6602_1/ctr0","",0.001,100000,DAQmx_Val_Hz,DAQmx_Val_Rising,DAQmx_Val_LargeRng2Ctr,0.001,4,""));
DAQmxErrChk (DAQmxCfgImplicitTiming(taskHandle,DAQmx_Val_ContSamps,1000));
/*********************************************/
// DAQmx Start Code
/*********************************************/
DAQmxErrChk (DAQmxStartTask(taskHandle));
printf("Continuously reading. Press
Ctrl+C to interrupt\n");
while( 1 ) {
/*********************************************/
// DAQmx Read Code
/*********************************************/
DAQmxErrChk (DAQmxReadCounterF64(taskHandle,1,10.0,data,1000,&read,0));
printf("Acquired %d samples: %g\n",read, data[0]);
fflush(stdout);
}
This is my first work with DAQmx, so I don’t understand what’s wrong
with my system (initialisation,…).
Thanks’ for help.
(English is not my native language so excuse me for language mistakes)
Best Regards
03-19-2007 01:56 PM
03-20-2007 02:52 AM
Hello,
I'm working on Linux and use GCC compiler.
Yersterday, I found that if I comment the line : DAQmxErrChk
(DAQmxCfgImplicitTiming(taskHandle,DAQmx_Val_ContSamps,1000)); the error disappears. Now, I have just a problem of time out with this exemple.
I try the following code and have the same error :
DAQmxErrChk(DAQmxCreateTask("Event1",&taskHandle));
DAQmxErrChk(DAQmxCreateCICountEdgesChan(taskHandle,"PCI6602_1/ctr0","Event1",DAQmx_Val_Rising,0,DAQmx_Val_CountUp));
DAQmxErrChk(DAQmxSetCICountEdgesTerm(taskHandle,"PCI6602_1/ctr0","20MHzTimebase"));
DAQmxErrChk(DAQmxCfgSampClkTiming(taskHandle,"/PCI6602_1/PFI38",1000,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,100));
//
// DAQmx Start Code
//
DAQmxErrChk (DAQmxStartTask(taskHandle));
//
// DAQmx Read Code
//
DAQmxErrChk (DAQmxReadCounterF64(taskHandle,1.0,10.0,&data[0],1,&read,0));
printf("Acquired %d samples : %.2f\n",read,data[0]);
03-21-2007 12:34 PM
03-23-2007 02:36 AM