I am trying to use the following example to acquire data using a start trigger and reference trigger such that I can save a fixed amount of sample before the reference trigger and the rest of the data (total number of samples-data before pretrigger) after the reference trigger happens. I am using NI-USB 6216. The manual says that "Port 1 and port 2 can be used as static digital I/O lines or PFI lines". I checked in NI device-monitor that the digital I/O lines are working when the trigger signal is sent. However, when I run the code, it does not wait for the start trigger before acquiring the data. Does it mean that NI -USB 6216 can not be used with digital triggering?
Either use Start Digital Edge OR Reference Digitial Edge but not both, not sure how DAQmx reacts to this.
According to the section External Digital Triggers of the manual USB-6216 can work with both kind of triggers.
Thanks for your reply. I did check separately with Start Digital Edge and Reference Digitial Edge. I found that 6216 does not react to any of the triggers at all. However, the digital channels showed the change in voltages when I checked in NI device monitor (digital channel/port 1/line 0-7). PFI1 stands for line 1 and PFI2 stands for line 2.
Hence my doubt was whether 6216 can work with digital triggers at all.
I can only tell you that the manual states that PFI 0..15 can be used as triggers Analog input (Start Trigger, Reference Trigger, and others).
Thanks for your prompt reply. I am a little confused here. Does that mean that the "start digital edge" trigger function and the "reference digital edge" function need to be replaced by something else? I am sure I am missing something but it would help to know a bit more. Please see attached. Also the manual says the PFI channels functionality includes static digital input. Does it mean it can not detect a changing digital level ( like a pulse signal)?
Thanks for your prompt reply. I am a little confused here. Does that mean that the "start digital edge" trigger function and the "reference digital edge" function need to be replaced by something else? I am sure I am missing something but it would help to know a bit more. Please see attached.
No, those are the correct functions, but as already stated do NOT use both at the same time. Have a look at the examples from the NI example finder (ie. Voltage - finite input.vi). Also keep in mind, that the DAQmx read will currently time-out after a max of 10 sec.
Also the manual says the PFI channels functionality includes static digital input. Does it mean it can not detect a changing digital level ( like a pulse signal)?
It means, that all DIO of that card can only be written or read with software tact (not with a HW timed clock like the AI).
I don't think I've ever tried setting up a task for both a start trigger AND a reference trigger. I'm not sure which (if any) devices support both simultaneously.
Your OP posting sounds like you *primarily* need a reference trigger so you can define both a # of pre-trigger samples and a total # samples. Have your tried this out without any attempt to configure a start trigger?
If you need both and your device doesn't support both in the same task, there's a likely workaround using a counter task. You'd set up a counter pulse train task that the AI task uses as its sample clock. The counter task would be configured to react to a start trigger, the AI task would continue to use (only) a reference trigger while also using the counter output as its sample clock.