Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Continuous buffer with interrupts doesn't refill the buffer

Hi To All,

I'm trying to use a PXI-6602 to acquire 8 channels of event counts. I'd like to use buffered event count at 100Hz, and I know that I have to use interrupts on some of the channels. My problem is that the 3 channels that use DMA work properly but the channels that use interrupts do not refill the buffer in a cicrcular fashion. Except for the configuring some channels for interrupts,  the configuration of the channels is identical (and done in a loop). In fact, it doesn't matter which channels I set for DMA and which for interrupts---the DMA ones work and the interrupts do not.

Note that the interrupts one DO fill the buffer one time only. They only seem to be unable to REfill it.

Anyone has any insight?

Thanks,
Gil
0 Kudos
Message 1 of 57
(4,681 Views)
Gil,

Thanks for contacting National Instruments.  This is an interesting issue.  Are you receiving an error of any kind?  What environment are your developing in, i.e. LabVIEW, CVI...?  How are you determining that the buffer ids not refilling?  I am not sure yet as to why this would happen. 

Regards,
Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 2 of 57
(4,663 Views)
Hi Kenn,

(a) I'm using Visual Studio 2005 and Traditional NI-DAQ 7.4.2f3.
(b) I'm not getting any error.
(c) I use an event callbacks to check the buffers.
To me more detailed, here is what I do: I use a PXI-6533 device to acquire (dummy) data at 100Hz and use its sample clock (on an RTSI line) as the clock for the buffered counters. I assign an event callback to the PXI-6533 for a callback every sample. That way, after the samples are acquired, I get the callback and I can inspect the buffers. I also keep a counter that counts the number of callbacks. That number (modulo the size of a counter's buffer) is also the position of the recently acquired event counts.
In the callback function I inspect the data after the counter index reached the size of the buffer and then I see that the counters that were configured with interrupts do not get refilled. I will try to prepare a sample application and post it (it's a little hard to untangle the code from my current application).

Gil

PS. One of the reasons I am using Traditional NI-DAQ is because I can access the naked buffers directly. I find that the overhead of calling the various read buffer functions is too large. (The other reason for using traditional NI-DAQ is that the latency for event callbacks is much better). G.
0 Kudos
Message 3 of 57
(4,658 Views)
Gil,

Are you doing a read any time during this?  Eventually the buffer should fill up and if you aren't reading the samples off you wshould get an error.

An example that I could run on my system and only exhibits the problem at hand would be great and then we could determine if there is a known reason for this or just a bug.  Thanks for the quick reply.

Regards,

Message Edited by Kenn N on 11-06-2006 12:35 PM

Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 4 of 57
(4,654 Views)
Hi Kenn,

I am not reading the buffer using the read buffer command. I access it directly. However, that being said, the DMA-configured channels do refill the buffer just fine and the interrupts ones do not. If I read the manual correctly, the buffer should overwrite itself without an error. It is only the read function that returns error codes if it couldn't read it fast enough.

Gil
0 Kudos
Message 5 of 57
(4,649 Views)
Gil,

Yeah that may be true.  Is it possible to recreate the issue on a very small scale?  So just one counter setup to do do IRQ transfers and see if ti exhibits the same behavior.

Regards,
Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 6 of 57
(4,645 Views)
Kenn,

I am attaching a VS2005 project that exhibit this behavior. You probably need to modify it to match your hardware device numbers. You can configure it in various ways (just look at the comments in the code).

Gil
0 Kudos
Message 7 of 57
(4,643 Views)
Gil,

I got your code.  I can't get it to build.  I get this error

fatal error LNK1104: cannot open file 'C:\Program.obj'

Any thoughts on what I need to do to get this to run properly.

Regards,

Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 8 of 57
(4,628 Views)
Hi Kenn,

Hmm. I don't know why it doens't compile. Do you have VS2005?

Anyways, to simplify things, I attach all the code in one file. You can probably compile it with any version of VS by creating an empty console win32 application and adding this file as the only file.  (and don't forget to link with nidaq32.lib)

Gil

0 Kudos
Message 9 of 57
(4,628 Views)

Gil,

I created a new win32 console app, linked the nidaq32.lib and included the nidaq.h file location and I still ge the Program error.

Regards,

Kenn N.
Applications Engineering
National Instruments

Message Edited by Jesse O on 11-07-2006 02:33 PM

Jesse O. | National Instruments R&D
Message 10 of 57
(4,621 Views)