LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read Encoder Trigger Camera (Error 200279)

I use LabView to read the angular measurement from using an incremental encoder and DAQ USB 6211. I need to trigger camera using TTL signal whenever the encoder reaches certain degrees. I need to do this continuously at the frequency of 12000 Hz at least. The problem is I am getting error 200279. 

 

INPUT DAQ Settings: 

  • Continuous Sampling
  • Buffer Size - 1
  • Sampling Rate - 12000Hz

I know increasing buffer size might solve the issue, but for accuracy I need to keep it as small as possible. From my understanding of buffer size I believe that - if for example I am aquiring data at 12000 Hz, and buffer size 100, I would only be able to read 120 data points in a second, and that's why I am keeping it as small as possible. (That's my understanding of buffer size, and if I am wrong, I would like to know what is actually buffer size)

VI.JPG

0 Kudos
Message 1 of 2
(2,420 Views)

Looks like error -200279 is from trying to read samples that aren't available anymore, which means that you've run past your data.  Asking your read function to happen as fast as your write function within 1 sample is a tall order at 12khz for any device.

 

 

From the DAQmx help:

When a continuous operation reaches the end of the buffer, it returns to the beginning and fills up (or in the case of output operations, reads from) the same buffer again. Your input application must retrieve data in blocks, from one location in the buffer, while the data enters the circular buffer at a different location, so newer data does not overwrite unread data.

While a circular buffer works well in many applications, two possible problems can occur with this type of acquisition: Your application might try to retrieve data from the buffer faster than data is placed into it, or your application might not retrieve data from the buffer before NI-DAQmx overwrites the data into the buffer. When your application tries to read data from the buffer that has not yet been collected, NI-DAQmx waits for the data to be acquired and then returns the data. If your application does not read the data from the circular buffer fast enough, you receive an error, stating that some data has been overwritten and lost. If losing data in this way is not important to you, change the setting of the OverWrite Mode attribute/property.

 

 

You should probably at how fast these events are that you trying to capture and how much margin you really have.  Then you can write the program to return data within an acceptable margin of time as an array of data, which is more efficient and easier to accomplish. For instance, if you are working with something at 500 rpm, that's .12 seconds / rev, then you want 90 degree sections, so that's .03 seconds.  If you need a resolution of 10 on that, you would need to return data and be done with processing within .003 seconds, or about 350 Hz.  Therefore, you can return perhaps 30 samples in one shot (400Hz), determine if you need to trigger, and wait for your daq to send more data. 

 

 



This avatar was scraped from an instance of good public spending: http://apod.nasa.gov
0 Kudos
Message 2 of 2
(2,413 Views)