LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting error when trigger occurs before all pretrigger samples are stored in buffer.

Hello,

I'm getting an error with DAQmx when the trigger occurs before all the pretrigger samples are stored in the buffer.

For exemple, i would like to aquire 1000 sample with 200 of them pretrigger samples. BUT, if the trigger occurs before the 200th sample (the 128th for exemple), i would like to keep those 128 samples and add 872 posttrigger samples.

For the moment, if there is less than 200 samples in the buffer, i get a error...

I'm using "Reference Analog Edge" for triggering.
Any clue on how to do that?

Thanks a lot.

Vincent
0 Kudos
Message 1 of 3
(2,809 Views)

Hello Vincent,

Thanks for contacting National Instruments.  I am assuming you are using LabVIEW for this application although this information will apply to any language calling the DAQmx API.  I am not sure which error you are getting, so I have provided explanations for two of the most common reference trigger errors. 

Whenever a reference trigger is used in a DAQmx task, it is necessary to acquire all of the pretrigger samples before a reference trigger occurs.  If the triggering event occurs before required number of pretrigger samples is taken, the task will ignore this.  If a triggering event does not occur again, the task will wait until the specified timeout value and throw an error.  This is explained in this knowledgebase.  This error can be avoided by decreasing the number of pretrigger samples, which would cause you to lose sample data.  It is also important to note that the number of pretrigger samples per channel is not settable after the task has started.  This makes using a reference trigger after an arbitrary number of samples something that has to be done in software.  The example link in the above knowledge base explains how to do a continuous acquire using a reference trigger.  This VI allows for you to set the pretrigger samples size to a small number which would guarantee that the reference trigger would be caught by the DAQmx task.  But, there is no lost data when reading since data is read until the trigger event occurs and then the specified number of post trigger samples is read and plotted.  After that, you can use software to manipulate the waveform to show the number desired number of pretrigger and posttrigger samples. 

Another possible source of error comes from acquiring more than one channel of data in the DAQmx task.  This requires special wiring considerations when using a reference trigger.  This error is explained in this knowledgebase.

Please post back if you have any more questions. 

Regards,
Browning G
FlexRIO R&D
0 Kudos
Message 2 of 3
(2,777 Views)
In fact, there's  an error because the trigger occurs before the end of the "pretrigger sample" so the task ignores it and the trigger timeout is reach.

I guess I can do what I want by using a software trigger!

Thanks a lot for your help!

Vincent
0 Kudos
Message 3 of 3
(2,770 Views)