Error -200284: Samples Have Not Been Acquired When Reading VI in DAQmx

Updated Oct 16, 2018

Reported In

Hardware

  • Chassis for SCXI

Software

  • LabVIEW Base
  • LabVIEW Full
  • LabVIEW

Driver

  • NI-DAQmx

Issue Details

When I run my LabVIEW program using a DAQmx Read VI I get an error that says:

Error -200284 occurred at DAQmx Read (Polymorphic).vi
Possible reason(s):
Measurements: Some or all of the samples requested have not yet been acquired

 
  • I don't always get this error. Sometimes I receive the error when I try to increase the resolution of my data. What can I do to increase the number of samples without running into this error?

Solution

The error was returned because the timeout occurred before any samples were received. The following are different ways to help you avoid this error:

Adjust the timeout value:
There is a timeout input for the DAQmx Read VI. The timeout specifies the amount of time in seconds to wait for samples to become available. If the time elapses, the VI returns an error as well as any of the samples read before the timeout occurs. If the input is not wired it is set to the default value of 10 seconds. If you set timeout to -1, the VI waits indefinitely. If you set timeout to 0, the VI tries once to read the requested samples and returns an error if it is unable. 

If your sampling rate is low and/or your samples to read is high this may allow the time to elapse, returning an error. To correct this, increase the timeout to accommodate the rate and the samples to read. In general, the timeout value should be larger than the number of samples to read divided by the sample rate.
 

Read later in your program:
Often, if your program is controlling the equipment that is generating the signal to be read, there is a delay before the samples are available to be read. In this case the task including the DAQmx Read VI should be started after the samples are available to be read. This can be done by properly wiring the error wires so the read happens after the command controlling the equipment generating the signal. Also, a wait timing VI can be used to allow enough time to pass for the samples to become available.

Increase the sample rate:
If the sample rate is low, it may be too slow for the device or the task. Verify that the hardware can support the rate desired. If the timeout is set to default and the rate is slower than 0.1Hz while acquiring more than one sample, the rate should be increased. The sample rate should be larger than the samples to read divided by the timeout.

Decrease the number of samples to read:
If the number of samples to read is large, this may cause an error for a counter input task. The number of samples to read may be larger than the number of samples the Read VI is able to read in before it times out. If the timeout is set to default (10 seconds) and the frequency of the sample of interest is 1 Hz, the Read VI may read a maximum of 100 samples before it completes an iteration. In this case, if the number of samples is larger than 100, you will receive error -200284 because the Read VI will expect to read more samples than there will exist.

Verify that the start trigger is configured correctly:
There are two options for triggering:
  • One is where the trigger is coming on a PFI/RTSI/Trig line. Verify that the trigger is operational and sending its signal properly through the hardware. Next, verify that the hardware can support the line on which the trigger is being sent. Finally, verify that the software task is looking for that trigger on the proper line.
  • The second option is that the trigger is coming from another task on the same board. Verify that the hardware can support this operation. One task may provide a trigger and the second task configures a trigger with the source of the first task’s trigger. Verify that the software is programmed correctly

Verify that the external timing is configured correctly:
External timing is referring to the task. If the timing is coming from a different task or device, it is considered external timing. There are two options for external timing:
  • One is where the clock is coming in on a PFI/RTSI/Trig line. Verify that the clock is running and sending its signal properly through the hardware. Verify that the hardware can support the line on which the clock is being sent. Then, verify that the software task is looking for that clock on the proper line.
  • The second option is that the clock is coming from another task on the same board. Verify that the hardware can support this operation. One task may have the clock configured and the second task configures a clock with the source of the first task’s clock e.g. a counter task using an analog sample clock. In this case verify that both clocks are configured exactly the same in software.

Additional Information

Example

The following is an example of where a counter task uses an analogue sample clock:

The default sample mode for the DAQmx Timing vi is Finite. The sample clock for the counter task(s) may be set to Continuous, but if the input is not wired it is set to the default value (Finite). When the sample clock is set to finite without the samples per channel wired, it will set a default buffer size based on the rate. Once the buffer is full, the sample clock stops and the counter task stops latching the counts because the clock source has stopped. The counter task(s) which are set to continuous will continue expecting more clock edges until the timeout elapses. Setting the sample clock source to Continuous will allow the clock to continue providing clock edges for the buffered counting task(s).

 

MAX vs DAQ Assistant

Using Measurement & Automation Explorer (MAX) you can configure a task to accomplish your purpose, and if it functions properly you can set the task in LabVIEW or verify that your task is configured with the same parameters. In LabVIEW you can generate example and/or configuration code from the task to see how the computer configures the task.
 
Using a DAQ Assistant you can configure the task and when it functions properly you can generate DAQmx code to see how the computer configures the task.
 

WAS THIS ARTICLE HELPFUL?

Not Helpful