Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Pretrigger delay

I need to acquire analog signals with DAQmx triggered by digital edge. I need a pretrigger as well.
Everything works fine, the DAQ assistant made the code for me ...
The only problem I saw is the following:
- I set a pretrigger of 1000 samples and my sample rate is 1000 samples/sec.
- I call the DAQmx Start Task.vi
- I raise the digital edge (connected as trigger) without waiting the pretrigger time (1 second)
- the acquisition starts but I don't see pretrigger samples.
This is quite obvious (I should let the DAQ board to acquire the pretrigger samples before starting acquisition), but:
- how can I automatically get an error if that occurs?
- how can I wait time until the DAQ is ready to acquire?
That's it.
0 Kudos
Message 1 of 14
(3,529 Views)
Hi,

the situation your are describing is not an error situation.
How many samples do you see when you apply a trigger immediately to the device?
When configuring a Reference Trigger you have to specify a Pretrigger number of samples and the total number of samples the acquisition should read.
If the number of samples you see after an "immediate" trigger has occurred is equal to the total number of samples you have configured, this means that the trigger is actually firing only after the minimum number of pretrigger samples has been acquired.
The driver is already waiting to have enough samples before a trigger is sensed.
Hope this is enough information,
regards,

AlessioD
National Instruments
0 Kudos
Message 2 of 14
(3,500 Views)
I program the acquisition of 2000 samples and a pretrigger of 1000 samples, rate 1000 samples per second.
If I don't wait a while after "Start Task" and I generate immediately the trigger, I get my 2000 samples, but I don't see the pretrigger acquisition (the acquired signal doesn't have the transition postponed of 1 sec).
If I wait 1 second before generating the trigger, I get the expected waveform.
What do you think?
0 Kudos
Message 3 of 14
(3,468 Views)
Hi,

what is the DAQ board you are using?
I will try to document an example that uses the exact same board you are using.
Regards,

AlessioD
National Instruments
0 Kudos
Message 4 of 14
(3,462 Views)
DAQmx PXI-6251.
My tries have been done with our system (the trigger is generated by a NI-Switch in scan mode), but I think the same result can be obtained, with a DAQ only, generating the trigger with a digital output.
Thanks
Dario
0 Kudos
Message 5 of 14
(3,461 Views)
I tested the behaviour on a 6251 board and still everything works fine.
Here is what I did:
- Configured the Reference trigger to come from a digital line --> DIO7 for example
- Sampling rate is set at 1000 S/sec
- Configured 1000 pretrigger samples --> this gives me 1 second before the trigger is recognized
- Set total number of samples to 3000 --> the acquisition keeps going for 2 seconds after the trigger is sensed

I have started the acquisition and after 250 ms I fired the trigger. All I see is the acquisition that is not returning because it is waiting for a digital trigger to occur

If I then, during the same session, fire a trigger well after 1 second since the application started, I then wait 2 seconds and the acquisition returns the 3000 samples.
If you try this(using a digital line as the trigger)and still have the same problem, then get in touch with us as we might want to discuss the possibility of testing your board.

AlessioD
National Instruments
0 Kudos
Message 6 of 14
(3,445 Views)
Alessio,
could you please send me the vi code you used, so I can try what you suggested?
Keep in mind that we don't have to tasks in parallel, but (using Start Task.vi) we do things in a sequential way (create task, set the trigger, start task, generate trigger, read samples acquired).
Thanks
Dario
0 Kudos
Message 7 of 14
(3,428 Views)
You can do it in MAX.
Just go to MAX, create a new task from there and try if the triggered acquisition works.
Let me know what your results are.
Regards,

AlessioD
0 Kudos
Message 8 of 14
(3,420 Views)
Using MAX we don't have a "sequential" structure (we have two different tasks running in parallel).
I have problem using this structure (within the same thread):
- configuration of DAQ task
- Start task (play)
- trigger generation
- Read samples acquired.
In that case I get the problem.
Regards
Dario
0 Kudos
Message 9 of 14
(3,400 Views)
It is not clear what are the 2 tasks running in parallel.
If you have a triggered acquisition, this should be one task. What is the other task you are referring to?
All I have done is to configure a task in MAX, save it and then use it from within LabVIEW.
Post your code here and we'll see if it works...
regards

AlessioD
0 Kudos
Message 10 of 14
(3,397 Views)