Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Change Detection Event Callback

Dear All,
 
I have several questions about the change detection event callback based from the VC++ shipping example, ReadDigChan_ChangeDetection_Events.
 
1.  What is the rate of the configure change detection timing?  It's not defined in the argument.
 

m_task->Timing.ConfigureChangeDetection(

risingEdgeLines,

fallingEdgeLines,

DAQmxSampleQuantityModeContinuousSamples, sampleSize);

 

2.  Is the callback single-threaded or multi-threaded?

3.  Is there anyway to differentiate which signal pin/s generated the change detection?  Is there an API for this operation or is it simply depends on the user how to figure this out?

     Is there any data passed in the userData to achieve this?

           void CReadDigChan_ChangeDetection_EventsDlg::OnDigitalChangeDetection(void* userData)

{

int value;

CNiComInitialize com(CNiComInitialize::Apartment);

if (m_taskRunning) {

      try  {

             //read sample

             m_reader->ReadSingleSampleMultiLine(m_data);

             ..........

 

 

Thanks a bunch, A 😃

 



Message Edited by angelmcdoggie on 05-21-2008 12:05 PM
0 Kudos
Message 1 of 9
(5,007 Views)

Hello again,

To add #3, what kind of data is being passed to the callback ()? 

Thanks,

A

 

0 Kudos
Message 2 of 9
(5,003 Views)

Hi angelmcdoggie,

 

 

1.       Change detection timing “Configures the task to acquire samples on the rising and/or falling edges of the specified lines or ports”, therefore the rate is completely dependent on how quickly your lines/ports change.

2.       It would probably be better to ask you what your concern is so that it can be fully addressed.

3.       Because change detection uses logic that only tells you that there was a change, it is impossible to know from hardware which line changed. However, the values of all lines/ports should be captured and you can compare the before/after cases to determine which line changed. 

I hope that helps.

 
Mark E.
Precision DC Product Support Engineer
National Instruments

Message 3 of 9
(4,975 Views)
Hello Mark,
 
Thanks for the pointers.
Regarding #3,
 
Based from the same shipping example, I compared a timestamp between a signal running at 1Hz and 100 Hz generated by t0, CH1 & t1, CH2.  In my program, I placed the 1st marker before the start task, while the 2nd marker is at the start of the callback function.  Based from the attachment, there is a great discrepancy with the program reading and scope measurement.  I don't have an idea why and how to fix it. 
 
I am using a cDAQ-9172, NI 9401 module  & VC++. 
 
Cheers,
A
 
 
 
 
0 Kudos
Message 4 of 9
(4,954 Views)

Hi angelmcdoggie,

 

 

Change detection is supported by the devices listed here. As new products come out, this page should be updated. Just to make sure it wasn’t missing anything, I checked the 9401 and it does not support change detection. You have the option of purchasing one of these devices if you need hardware change detection, or possibly implement some logic in software that monitors every line and notifies you of any changes you specify. A software solution doesn’t appear to be trivial.

If you would like more information about purchasing our products, please visit ni.com/contact.

 
Mark E.
Precision DC Product Support Engineer
National Instruments

Message 5 of 9
(4,940 Views)

Hello Mark,

Thanks again for the info.  I would like to know the difference between digital change detection and hardware change detection.

Best regards,

A

0 Kudos
Message 6 of 9
(4,932 Views)

Hi angelmcdoggie,

 

 

Digital change detection is something that happens in hardware, as described here.

 


Feel free to read this DevZone article or check out the links on the left to learn more.

 

 

 
Mark E.
Precision DC Product Support Engineer
National Instruments

Message 7 of 9
(4,924 Views)

Hi Mark,

Could you please tell me if any of the C Series digital input modules (for NI CompactDAQ) supported the Change Detection feature?

thanks

0 Kudos
Message 8 of 9
(4,762 Views)

Hi nantek,

 

 

I used a couple of resources to find an answer for you, so let me share those with you, and the community.Smiley Wink

The NI cDAQ-9172 User Guide and Specifications has a section on “Change Detection”, currently on page 37. You need a module that supports correlated measurements, and they have to be placed in slots 1 through 4.

 

 

I hope that helps.



Message Edited by Mark E on 06-26-2008 01:11 PM

Mark E.
Precision DC Product Support Engineer
National Instruments

0 Kudos
Message 9 of 9
(4,742 Views)