05-04-2022 11:38 AM
Hello,
I have a problem with continuous data acquisition with DAQ PXI 6281.
I am using an external timing with a clock coming from a moving cart. When the cart is moving, I recover a TTL signal from it which gives the timing to the data acquisition. Acquisition continues as the cart moves forward. I take 1000 samples at each round of the while loop. At each turn of the while loop, I ask the cart if it is moving forward (while (itc4.query('1TS?')=='Q\r\n'):). If it is still progressing, I continue acquiring 1000 additional samples. If not, I stop the acquisition.
The problem is that the engine can stop when the 1000 samples are not yet acquired. And when the engine stops, there is no more clock. I then receive the following message: "SamplesNotYetAvailableError: 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."
"
How to get out of the loop when the buffer is not filled?
Thanks in advance
renaud
PS photo of the program attached
05-04-2022 02:56 PM
Could you please explain more about this "cart" and the significance of "(while (itc4.query('1TS?')=='Q\r\n'):)"?
BTW, the image was not attached and please attach the actual VI and not the image. (VI preferred in LV2016 version).
05-04-2022 03:30 PM
Thank you for your reply.
Let me explain, I work in photonics. I have an optical interferometer with which I analyze telecom components. One of the mirrors is mobile and placed on an air bearing stage (which I called a cart in my first email) which is driven by newport esp301 driver with USB connection. To make measurements, I need to know the position of this mirror very precisely. So I insert this mobile mirror into another positioning interferometer. When the mirror is translated, the interference fringes of this interferometer vary in front of a detector. And I know that between two shiny fringes, the mirror has moved by lambda/4 or 0.15 micrometer precisely.
I use this interferometric signal as an external clock for my first signal and then know that between each sample, I have a mirror displacement of lambda/4.
So by doing (while (itc4.query('1TS?')=='Q\r\n'):)"?, I ask NewportESP301 if the mirror is moving or not(write(1TS?)) and the device responds Q= moving or P= stopped.
As long as the mirror moves, the measurement continues with the external clock from the interferometer. When the mirror stops, ESP301 responds P but the clock signal also stops.
But my program is in python.
In what form do you want a copy?
05-04-2022 04:04 PM
Your description now starts to make sense, please attach the py file to your reply.
05-04-2022 04:10 PM
Here is
05-04-2022 05:21 PM
I'm no real help with the Python syntax, but here's a general approach you could take:
When you first get that error, query the DAQmx task for the # samples available. Then ask to read *that* amount instead of the normal 1000.
-Kevin P