From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Change detection for more digital inputs

Solved!
Go to solution

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

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

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

What Is Change Detection and How Does It Work On The 653x DIO Boards?

The mask can be set in the DAQmxCfgChangeDetectionTiming function.

best regards
Alexander
0 Kudos
Message 2 of 5
(2,975 Views)

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

 

0 Kudos
Message 3 of 5
(2,924 Views)

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

0 Kudos
Message 4 of 5
(2,914 Views)
Solution
Accepted by topic author Fasching_K

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

 

best regards
Alexander
0 Kudos
Message 5 of 5
(2,902 Views)