Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 

m-series counter interrupts/dma

I'm trying to get the counters on an m-series board (6281) to generate interrupts, so I can do buffered event counting. As a test, when I turn on terminal count interrupts, then make the counter count down to zero, no interrupt is generated. It is disarming when it hits the TC (I have it configured to stop counting and disarm on TC) but no interrupt. I have the TC interrupt enabled in the interrupt A enable register (i'm using counter 0), and I am able to generate TC interrupts using an e-series board. I've noticed the m-series has some additional bits in the Gi_DMA_Config register and I've played with them but to no effect.

Is there any extra magic to make counter interrupts work on m-series boards? Is there any example code of buffered counting using m-series boards (there's none in the m-series ddk, although there is for the 660x boards in the 660x ddk)? Ultimately, I'd like to get buffered counting working with DMA, but for now I'd just like to get it to generate an interrupt.
0 Kudos
Message 1 of 7
(8,970 Views)

Hi fmhess-

I created an example recently for DMA-based buffered period measurement.  It's attached as gpctex6.cpp and should be a good starting point (along with gpctex1.cpp from the M Series MHDDK) to get buffered edge counting with DMA working.  This should give considerably better performance than interrupt-based transfers; will DMA-based transfers (using the MHDDK's DMA library) work for your app?

Thanks-

Tom W
National Instruments
0 Kudos
Message 2 of 7
(8,954 Views)
Hi Tom, thanks for the response. It appears I was doing something stupid to the Gi_DMA_Config register, because I've got counter dma and interrupts working now with an m-series board. Now my issue is getting dma to work with an e-series board. The stc/e-series register manuals make some vague remarks about how the e-series boards generate dma requests via the "secondary interrupt bank". I tried enabling all the interrupts in the Second_IRQ_A_Enable_Register and Second_IRQ_A_Enable_Register but I still don't get any dma transfers from the counter. Is there any light you can shed on this issue? You wouldn't have a version of your example code for e-series would you? Thanks,

Frank
0 Kudos
Message 3 of 7
(8,937 Views)

Hi Frank-

Here's an example I did recently for DMA-based period measurement with an S Series.  From a counter/timer perspective, S Series and E Series are identical (they both use the DAQ-STC ASIC for counter operations).  You might have to strip some S Series-specific stuff (and replace with E Series references from the DDK), but this should hopefully help get you going.

Hopefully this helps-

Tom W
National Instruments
0 Kudos
Message 4 of 7
(8,934 Views)
Thanks for the example code, it's helped me get dma working on e-series now. I hadn't thought of setting the Gi_Read/Write_Acknowledges_IRQ bits, and was accidentally trying to write to the Second_IRQ_A/B_Enable register directly instead of through the windowing registers.
Message 5 of 7
(8,890 Views)

Hey Frank-

Glad to hear it- let us know if you run into anything else.

Thanks-

Tom W
National Instruments
0 Kudos
Message 6 of 7
(8,886 Views)

HI  fmhess

      I tried to generater a interrupt to ack interrupt function, through a DIO line's status changed or a TC event, so i can control my other device  when that event on.

     I have no idea about how to set the interrupt registers and DIO (PFI) relatived registers.

     could you give me some help .

     Thanks-

      Su

0 Kudos
Message 7 of 7
(8,504 Views)