Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

triggers using nidaq-mx

Hello

 

I'm using the PCI-6259  M series multifunction DQ board on a linux box (SLES 10.2) and am using the ansi_c api and the driver is NI KAL 1.4.  My application requires 10 analog inputs, 8 digital inputs 8 digital outputs and all 4 analog outputs to interface with a piece of HW in real-time.  Currently I am doing straight software timing meaning I am not using the DAQmxCfgSampTiming call but am doing "on demand" sampling at a hw controlled 1 ms interval using the NI read/write api calls.  I use 4 NIDaq tasks (analog input/output,digital input/output).   I was attempting to add a analog input trigger to my system to mark a specifi event.  Here's what I want to do and after reading the NI documentation I don't think I can do this.  Please correct me if I am wrong.

 

I want to keep the software timing mentioned above in place.  I want to add to my analog input task a trigger event for APFI1 and assign to it a callback function when the event accurs.  From the examples that comes with the driver (Acq-IntClk-AnlgStart) it looks like the trigger is mainly used to control WHEN the sampling occurs in the task.  There looks to be no way to assign a callback specifically to a trigger event.  Again, I want to keep my software timing described above and only want to be notified through a callback when my APF1 event has occurred.  Hope I've described this adequately.

 

Kevin

0 Kudos
Message 1 of 5
(3,609 Views)

Hi Kevin,

         If you refer to the NI-DAQmx C Reference Help, you should find a section on Software Events.  It describes setting up a callback function to occur based on an event.  The closest one to what you are looking for is the DAQmxRegisterSignalEvent function.  However, I do not believe this will work for you as you are trying to use an analog trigger whereas this function detects digital edges.

 

The only other suggestion I have is to compare your analog input values as you read them and evaluate for a certain level but I don't know how this would affect your timing.

 

Unfortunately this was all I could come up with but maybe others have a better idea.

0 Kudos
Message 2 of 5
(3,567 Views)
I believe Anita's on the right track.

While DAQmx does not provide a signal event for an Analog Trigger which would make registering for that signal event straightforward, the driver does allow a program to register a signal event for Change Detection. You may be able to get a software callback to fire when your APFI1 conditions are met if you export the Analog Comparion Event to a PFI line, loop that output back to a digital input line that is part of a digital input task configured for change detection, and register for the Change Detection Event.

Use DAQmxConnectTerms() to make the connection between "/Dev1/AnalogComparisonEvent" and "/Dev1/PFIn" (conversely, use DAQmxDisconnectTerms() to restore the board's state). Use DAQmxRegisterSignalEvent() like Anita said to set up your callback on the Change Detection Event.
Joe Friedchicken
NI Configuration Based Software
Get with your fellow OS users
[ Linux ] [ macOS ]
Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
Message 3 of 5
(3,537 Views)

All

 

 

Thank's for the responses.  You've answered my question. I wanted to avoid doing the change detect in my application as I'm already taking about 100 microseconds to do the "on demand" reading of the analog inputs mentioned above. I was hoping to farm off the triggering functionality to the NI card as I figured it would have better respnse.  I will check out Joe's suggestion of routing the analog output to a digital input and then use change detect to fire the callback.   I'm curious if I can also get the value of the analog signal that caused the trigger, looking into this now, and also the X-series cards.

 

Kevin
0 Kudos
Message 4 of 5
(3,515 Views)
Hey Kevin,

I think we're using slightly different vocabulary, and I'm not sure if I misunderstood you or if I left out details in my post. I'd like to clarify some more and see if I can get on the same page as you.

If you haven't read it already, I recommend looking at the section "Routing Analog Comparison Event to an Ouput Terminal" in the M Series user manual [1]. That section has illustrations that show how different analog trigger configurations affect the Analog Comparison Event output. The signal is indeed an output, but it is not an analog output. Rather, it's a digital output -- the output of a programmable comparator that follows standard TTL levels.

It is possible to read the value of the analog signal that caused the trigger: just be sure that signal is wired to an analog input channel in addition to APFI1 and then add that channel to your analog input task.

X Series devices are not supported by DAQmx 8.0.1 since they didn't exist when that version was released. There hasn't been another release of DAQmx for Linux since 8.0.1, so X Series on Linux has no solution right now.

[1] M Series User Manual
http://digital.ni.com/manuals.nsf/websearch/2025C99AB0614F9E8625748000577B9A
Joe Friedchicken
NI Configuration Based Software
Get with your fellow OS users
[ Linux ] [ macOS ]
Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
0 Kudos
Message 5 of 5
(3,512 Views)