Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

cDAQ hardware interrupt through DIO module NI-9401 or NI-9403 with cDAQ-9178 chassis

Hello.  

 

I am trying to monitor a digital pulse that is infrequent and is ~100ms in duration.  My system polls the input and will sometimes miss the pulse.  I have been unable to find a method to use this input as an interrupt so that I do not miss it.  My hardware is a cDAQ-9178 chassis and either a NI-9401 or NI-9403 DIO module.

 

Reason that I am missing the pulse is that I am also using a NI-9217 RTD module and reading all four channels in high-resolution mode takes ~800ms.  During the NI-9217 read the pulse often occurs and is missed.

 

Is there a simple method to switch from polling this digital input to an interrupt?

 

Thanks

 

Dan

0 Kudos
Message 1 of 6
(1,928 Views)

I suspect what you're looking for is called "Digital Change Detection" in the DAQmx API.

 

Note that, in C Series, change detection is not supported on serial digital modules (such as the NI 9403), only parallel digital modules (such as the NI 9401).

——
Brandon Streiff
ni.com/compactdaq · ni.com/daq
0 Kudos
Message 2 of 6
(1,900 Views)

Hi Dan,

 

How do currently have the tasks for the 9217 and 9401 configured? If these two modules are configured in separate tasks with different sample clocks, then the analog reading of the RTD shouldn't be interfering with the digital detection of the 9401. 

 

What is the sampling rate of the 9401? Even 10 kHz should be sufficient to detect the 100ms periodic signal.

 

I'm not sure that an interrupt would be necessary if both modules are using individual sample clocks.

 

Regards,

 

 

Alex
Hardware Engineer
0 Kudos
Message 3 of 6
(1,898 Views)

Alex:

Thank you for your prompt reply.  I am new LV user, only been doing LV for a couple of months (but have quite a bit of hardware and firmware experience on microcontrollers).  I just simplified my application for illustration purposes.  I am currently running both tasks in [1 Sample (On Demand)].

 

I believe you are suggesting using hardware triggering?  Have not used that feature yet.

 

I have attached my VI.

 

Dan

 

 

Download All
0 Kudos
Message 4 of 6
(1,893 Views)

Dan,

 

From the attached code, I was unable to see how you've configured the sample clocks in your AI and DI tasks since you've imported them.

As Brandon recommended, the Digital Change Detection example will work with your 9401.

 

Digital Change Detection

http://www.ni.com/tutorial/4102/en/

 

You can modify this example above to read only a single sample like the code you've attached to this forum.

 

Best,

Alex
Hardware Engineer
0 Kudos
Message 5 of 6
(1,886 Views)

Alex:

Sorry about the slow reply.  I have switched from High-resolution mode to high-speed mode on the 9217 and implemented a moving average (on 4 samples) on the data.  Since the averaging is moving, it does not really slow down my main loop that is polling for the input pulse on the DIO input.  I can reliably catch the pulse now.  I still need to investigate the Change Detection example.  I was worried about using the free running mode clocking of the ADC because over time it would seem that the system would get out of sync if the code was not reading the buffer at exactly the same speed it was getting filled.

Dan

0 Kudos
Message 6 of 6
(1,852 Views)