LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQPad 6020E: Digital Output while waiting for triggered analog input?

I have a DAQ problem with a DAQPad 6020E. I'm using Labview 6.1. I would like to do the following:
I want to acquire analog signals coming to the DAQPAd, triggered by writing to the digital port of the same DAQPad, i.e. by using the LabView-generated output of the digital port as trigger for the analog data acquisiton.

My Labview program uses a sequence structure with 3 frames.
In frame 1, I set up a triggered analog acquisition with AI config and call AI start to make a triggered analog acquisition.
In frame 2, I write to a digital port, and I connected the OR'ed signal of all lines of the port to the TRIG/PFI0 input of the board externally.
In frame 3 I use AI read to get the data.

Thi
s VI doesn't work. It always times out on the triggered acquisition. I believe that once I have set up a triggered analog data acquisition and the board is waiting for the trigger signal, it cannot output anything on the digital port. I believe this because I also tried simply setting up a triggered analog acquisition and then, while waiting for the trigger, to write to the digital port by using the test panel in the DAQ explorer. this also didn't work.

Is it true that you cannot write to a digital port while waiting for a triggered acquisition? Is there any workaround to this?

best regards
Martin
0 Kudos
Message 1 of 4
(2,988 Views)
Martin,

When you setup an analog input with a digital trigger, the AI Read.vi will wait until it either receives a digital trigger or a timeout. If the AI Read VI is in a sequence structure, it will not allow the program to flow to the next frame until it receives a trigger or timeout. Also, if the AI Read.vi is in a while loop, it will not allow the loop to iterate until it receives a trigger or timeout. Therefore, if you would like toggle the DIO line while the AI Read.VI is waiting, you will need to use two parallel while loops. One loop will contain the AI Read.VI and the other will contain the Write to Digital Line.vi. This way, the other loop containing the digital code will still be able to iterate while the other loop is waiting on a trigger. You can
also use occurrences to synchronize the two loops to ensure that the digital loop gets equal priority. Note: Using a digital line to trigger your AI does not really offer any timing benefits. You could do the same thing in software without out involving writing to the digital line. You should use an external digital line to trigger the AI. This will give you the full benefit and speed of the trigger without depending on the software to change a DIO on the device.
0 Kudos
Message 2 of 4
(2,988 Views)
Thanks for the answer. I'm not sure it helps though 😞

As I explained in my post, I call AI start and not AI read, and then I want to write to the digital port. So I'm not sure whether this is relevant - does AI start also wait until it receives a trigger?

Your note is of course correct in principle, but doesn't apply: I didn't want to explain the experiment in detail - I use the digital port to make my instrument do something, and then I want to read the response it gives me on an analog output. Of course, if the instrument had a trigger output that tells me when it starts doing something, I would use that. But since it doesn't, I thought I would "cheat" by using my signal to the instrument as a start trigger for my data acquisition.

I'll t
ry that thing with the two loops. I'm not quite sure how things go with timing there though - I want to set up the AI acquisition before I send the actual trigger signal. I guess I can use two loops, in one I put the AI setup, in the other I put a sequence structure with a wait in the first frame, and then the digital output in the second frame. Does that make sense?

cheers
Martin
0 Kudos
Message 3 of 4
(2,988 Views)
I also tried the method of using two while-loops, one containing the AI logic (AI config, AI start, AI read, AI clear), and another while-loop containing a sequence structure with 2 frames: in the first frame a 2000ms wait, in the second the Digital write. This didn't work as expected: the digital port was only written after the AI read timed out.

so is there any way to write to the digital port while waiting for analog input?

cheers
martin
0 Kudos
Message 4 of 4
(2,988 Views)