Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 

PCI-6229 Interrupt on external clock

Hi,

 

I want to generate an interrupt from an external clock (2 kHz). I can't find anything on generating an interrupt from a Digital Input. So I have tried using the G0 TC interrupt.

 

I modified gptcex1 for a countdown timer as described in the source file.

 

- set to reload on TC

- set source switching to same.

- enabled G0 TC interupts

- connected my input clock to PFI 8

 

It appears that "reload on TC" reloads 0xFFFFFFFF instead of my initial count. So I have to reload my initial count in the ISR.

 

board->G0_Load_A.writeRegister(GPCT0_INITIAL_COUNT);

 

This results in an interrupt every GPCT0_INITIAL_COUNT + 1 cycles. This means that I can only generate an interrupt every second cycle at best.

 

Is there some way to overcome this limitation or is there a better way to achieve my aim?

 

 

0 Kudos
Message 1 of 3
(6,503 Views)

Russell_Thamm wrote:

 

I want to generate an interrupt from an external clock (2 kHz). I can't find anything on generating an interrupt from a Digital Input.

 

<snip>

 

or is there a better way to achieve my aim?


Hi Russell,

Ideally, the best course of action is to use change detection [1]. Unfortunately, the M Series DDK does have change detection support like the X Series DDK does [2].

However, if you have the analog input or analog output subsystem available, you can use your 2 kHz signal as the sample clock and enable interrupts on the START signal. Since the device will expect to acquire or generate samples, you'll need to either throw that acquired data away or provide safe, dummy data to generate.

Analog input: tInterrupt_A_Enable :: setAI_START_Interrupt_Enable

 

Analog output: tInterrupt_B_Enable :: setAO_START_Interrupt_Enable

 

[1] M Series User Manual :: Change Detection (page 104)
http://www.ni.com/pdf/manuals/371022k.pdf

[2] How to generate an interrupt using DI change detection on m-series card
http://forums.ni.com/t5/Driver-Development-Kit-DDK/How-to-generate-an-interrupt-using-DI-change-dete...

Joe Friedchicken
NI Configuration Based Software
Get with your fellow OS users
[ Linux ] [ macOS ]
Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
0 Kudos
Message 2 of 3
(6,493 Views)

Got it working thanks.

 

 

0 Kudos
Message 3 of 3
(6,471 Views)