11-07-2016 04:32 AM - edited 11-07-2016 05:00 AM
Hello,
I have a questions about the detection of a change on an digital input. I have tried this before and it works well. Now I would like to start a litte program when a second digital input jumps from low to high. I set the task and wanted to start both "interrupt" parallel but now I got a failure that the specified resource is reserved.
How can I start two or more change detection in one programm?
/*
DAQmxCfgChangeDetectionTiming(DigitalInterruptPauseTaskHandle, DIInterruptChannel_Pause, DIInterruptChannel_Pause, DAQmx_Val_ContSamps, 1);
DAQmxRegisterSignalEvent(DigitalInterruptPauseTaskHandle, DAQmx_Val_ChangeDetectionEvent, 0, ChangeDetectionPauseCallback, NULL);
*/
// First change detection on Pin 1
DAQmxErrChk(DAQmxStartTask(DigitalInterruptPauseTaskHandle));
// Second change detection on Pin 2
DAQmxErrChk(DAQmxStartTask(DigitalInterruptTaskHandle));
// Start a analog task
DAQmxErrChk(DAQmxStartTask(AnalogOutTaskHandle));
There is another digital out task additional to the three task above
Hope someone can help me.
Best regards
Solved! Go to Solution.
11-10-2016 12:44 AM - last edited on 01-03-2025 10:59 AM by Content Cleaner
Hello Fasching_K,
you have to use the complete port and set a mask which lines you want to watch.
Digital Change Detection in NI-DAQmx
The mask can be set in the DAQmxCfgChangeDetectionTiming function.
11-14-2016 12:28 AM - edited 11-14-2016 12:51 AM
Can you give me an example how I write the line? I do not know how I can adresse two pins in one line (they lie not side by side there are other pins between)?
Best regards
11-14-2016 01:24 AM - edited 11-14-2016 01:38 AM
I can't also adress the whole port because on the same port I have digital ouputs that are already adressed or is it only possible to adresse pins who are side by side?
Hope someone can help me
Best regards
11-14-2016 07:27 AM - edited 11-14-2016 07:28 AM
Hello Fasching_K,
i have not tested if only lines are possible i used and the complete port of the card. Normally you should use the port and with the risng and faling edge input on the DAQmxCfgChangeDetectionTiming function you can set the mask wich lines should be watched or not 0 not watched 1 watched.
Example:
C:\Users\Public\Documents\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Digital\Read Values\Read Dig Chan-Change Detection