Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with pre-trigger programming in DAQmx

I 've got the exactly the same questions as Yajai's (see How to set a pre-trigger when triggering off a physical channel).

 

My application uses more than one channel to acquire data, and I need the pre-trigger and also the post-trigger data. I used to use VC++ 6.0, and Traditional NI DAQ with 6062E for my application. The trigger issue was handled by the driver. Now I am trying to upgrade to DAQmx, but I have problem with the trigger. I can't use reference trigger to get the pre-trigger data, because it support only one channel data acquisition. It seems I have to poll the trigger by myself, which is the last thing I would like to do.

 

Could someone kindly tell me what I should do to solve this problem?

 

Thanks,

 

RUI 
0 Kudos
Message 1 of 6
(3,799 Views)
RUI,

Thanks for contacting National Instruments.  So if I understand you correctly you previously had more than one channel, but not more than one trigger.  You had a reference trigger and then acquired the data points from your multiple channels.  This should be able to be done in DAQmx.  If you have more than one channel in a task, say channels 0-4, you would use channel 0 as your trigger source and the driver will then acquire the data points for all channels 0-4. 

This is quickly done in LabVIEW by editing the example with a reference trigger to include multiple channels.

Regards,

Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 2 of 6
(3,778 Views)
RUI,

Let me clarify, I spoke a bit too soon as it were.  You can accomplish multi-channel reference triggering in one of two ways.  Either in hardware by applying your analog signal trigger source to PFI0 (E-series) or APFI0 (M-series) and use that line as your DAQmx trigger source.  The other way is to do it in software using the DAQMx Analog SW trigger.  There is a LabVIEW example that shows how to do the software trigger.  Both of these methods will allow you to get pre-trigger and post-trigger data for mutliple channels.

Regards,
Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 3 of 6
(3,771 Views)

Hi Kenn,

Thanks for reply. Actually my application is an impact hammer test, which usually use two channels, one channel is for the impact hammer, another for the accelerometer. I am using VC++ 6.0 to program, not LabView. I have tried DAQMx Analog SW trigger, using the function DAQmxSendSoftwareTrigger, but it did not work. I might be not using the function correctly. Do you have any examples in C or VC++?

Thanks
0 Kudos
Message 4 of 6
(3,764 Views)
RUI,

So using the DAQmxSendSoftwareTrigger is not the function you want to use.  The best way to do what you want is to wire your signal to PFI0 (E-Series) or APFI0 (M-Series) and setup a reference trigger based on that source.  You can then easily add all the channels you need and get the pre and post-trigger samples you desire. 

If you look into the LabVIEW code I posted yesterday, which you may not be able to do, there is a vi that "sends a software trigger", but all it is really doing is comparing the incoming datapoints to a reference and stopping the while loop, or ending the continuous acquistion, when the signal hits the reference.  It is all done using standard math and compare functions with no DAQmx vi's.  You can replicate that behavior if you like, but the hardware solution should prove to be easier to code and more reliable.

Regards,
Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 5 of 6
(3,737 Views)

Hi Kenn,

Now I am clear about what I can do for my application. I can either use PFI0 (E series) as a hardware trigger resource, or poll the datapoints as a software solution.

Because later I will try USB-9233 in our application and it seems no such pin as PFI0 has been provided in this USB DAQ card, now I have to use software method to do the job. It would not be very difficult to program the polling, but to save my efforts, it would be nice if I can have an example for reference.

At the time I am also wondering why NI removed the software trigger functionality from DAQmx. In traditional NI-DAQ the polling is automatically done by the driver or a DLL. That is very convenient for the user.

Thank you very much for support.

RUI

0 Kudos
Message 6 of 6
(3,723 Views)