Hi everyone and happy New Year! I am interfacing PCI 6259 + BNC2110 with Qt Creator IDE (based on C++). I am trying to sample signal using external triggering. I have a running microprocessor that produces trigger signals.
DAQmxCfgChangeDetectionTiming seems like a good approach. I configured it to sample at the falling edge of my signal that is hooked to port0/line0. Thus, DAQmxRegisterSignalEvent initiates callback in which I perform sampling.
The problem is that I wish to have two or more callbacks that would react on DAQmxRegisterSignalEvent. Currently, I need to have two virt. channels - port0/line0 and port0/line1. The change in one of them should call it's own callback. The theoretical approach would look like:
void main()
{
...
DAQmxCreateDIChan(task1,"Dev1/port0/line0","",DAQmx_Val_ChanPerLine);
DAQmxCfgChangeDetectionTiming(task1,NULL,"Dev1/port0/line0",DAQmx_Val_HWTimedSinglePoint,1);
DAQmxRegisterSignalEvent(task1,DAQmx_Val_ChangeDetectionEvent,0,signal_from_line0_callback,null);
...
DAQmxCreateDIChan(task2,"Dev1/port0/line1","",DAQmx_Val_ChanPerLine);
DAQmxCfgChangeDetectionTiming(task2,NULL,"Dev1/port0/line1",DAQmx_Val_HWTimedSinglePoint,1);
DAQmxRegisterSignalEvent(task2,DAQmx_Val_ChangeDetectionEvent,0,signal_from_line1_callback,null);
...
}
void signal_from_line0_callback()
{
...take a sample;
return;
}
void signal_from_line1_callback()
{
...do other things;
return;
}
However, this schema does not work. It seems like when a change occurs on line0 or line1, the DAQmxRegisterSignalEvent does not care on which line the change was, and thus, tries to call one of the callbacks. Is there a way to make this approach to work? How to find out which of the lines the change occured on? I need changes in line0 or line1 to trigger different callback functions. Thank you very much in advance.
No, unfortunately. M Series devices
OR
all of the line changes [1] for change detection, so you can only register one callback.Your callback will need to act as a dispatcher. When it receives the change detection event, it needs to read the state of the device's lines, decide what to do, and forward the action on to the responder for the line that changed.
References
[1] M Series User Manual :: DI Change Detection (page 104)
http://digital.ni.com/manuals.nsf/websearch/2025C99AB0614F9E8625748000577B9A