11-04-2025 02:37 PM
Hardware:
PXIe-1071, PXIe-8862, PXIe-6349
Task/Problem:
I need to acquire a continuous analog signal that is triggered to start and stop by an external piece of equipment. Basically, I will hit the start button on my DAQ code and it will wait for the external equipment to send a trigger. Then the code will acquire data until it recieves another trigger from the external equipement.
Attempted Solution:
Currently, I have attempted to utilize a pause trigger on the (APFI 0 channel) to solve my problem. I use the setting "pause when below" and set the level to 2 V. Since my external equipment sends a 3.3 V signal when data collection is active, the DAQ code only collect data when the 3.3 V signal is on. However, there is no way for me to stop the code when it is paused. The code gets "stuck" in the while loop. I have to click my stop button and then unpause the signal with my external equipment. This makes the code go through one more loop and collect more data then exits the code.
I have pasted a simplified version of the code I am using below. It from the "Voltage - Continuous Input" example VI. My original code is similar but writes the data to an output file as well.
Image of Attempted Solution (Simplified):
I have looked at a few solutions online but all of them require finite sampling. This would require me to know how long I want to record data for beforehand. However, this is not possible for my application.
Does anyone have a suggested solution for this problem whether it is utilizing the pause trigger or another type of trigger? Let me know if I need to provide more details or explanation. Thank you!
11-04-2025 08:51 PM
Change the timeout of DAQmx Read VI from -1 to a finite value like 500ms so that the VI is not locked while waiting indefinitely for new data.
The VI will return error when the acquisition is paused and there is no sample being captured, but you can clear the error knowing that the acquisition is paused.
11-05-2025 07:58 AM
Hi ZYOng,
Thank you for quick your response!
First, I tried your suggested method out, and I was able to stop the pause trigger with the timeout feature. However, I have run into a complication with this method.
Currently, if I set the timeout to something like 5s, but I don't initially trigger an event before the 5s is over then the code times out and throws an error. I can set the timeout to be longer, but I would have to know how long it would be until my trigger event would happen. Also I would then have to wait that amount of time after acquisition for the timeout to occur.
Do you have any suggestions for how I can fix this?
11-06-2025 12:17 AM
As I have mentioned previously, use a smaller timeout value and clear the timeout error.