<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Max sampling rate on 6602 and interrupt programming. in Counter/Timer</title>
    <link>https://ni.lithium.com/t5/Counter-Timer/Max-sampling-rate-on-6602-and-interrupt-programming/m-p/244451#M2467</link>
    <description>&lt;SPAN class="noindex"&gt;Hi Kevin,&lt;BR /&gt;
&lt;BR /&gt;
Thanks for your help. The labview solution with PCI 6002 card is a
temporary solution. However, single digits of kHz should still be
worthwhile until we start our second solution (using an FPGA to
timestamp). However, I'm not getting even close to kHz. Currently
testing with the pulse train generators and only 3 counters going (so
they should all be DMA transfers) I get maybe 10 timestamps a second
from each channel. So I'm assuming something must definitely be wrong
to get so low a rate. Would changing the circular buffer size (samples
per channel on the DAQmx Timing.vi) or the number of samples to read at
once (a number used along with the property AvailSampPerChan to
determine when to read) have any effect? Any other ideas? Also when the
signal gets up in the 20kHz range rather then just being able to sample
say 50% of these the program dies, it doesn't read any samples. Any
ideas?&lt;BR /&gt;
&lt;BR /&gt;
Unfortunately, I can't really consider a different measurement for the
app. We're doing coincident measurements, so highly accurate time
stamps to tell which photons go together is a pair is necessary.&lt;BR /&gt;
&lt;BR /&gt;
&lt;/SPAN&gt;&lt;SPAN class="noindex"&gt;I'm going to try your suggestions on interrupt programming now.&lt;BR /&gt;
&lt;BR /&gt;
Thanks again,&lt;BR /&gt;
Chris&lt;BR /&gt;
&lt;/SPAN&gt;&lt;SPAN class="noindex"&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Thu, 21 Jul 2005 14:20:42 GMT</pubDate>
    <dc:creator>ChrisErven</dc:creator>
    <dc:date>2005-07-21T14:20:42Z</dc:date>
    <item>
      <title>Max sampling rate on 6602 and interrupt programming.</title>
      <link>https://ni.lithium.com/t5/Counter-Timer/Max-sampling-rate-on-6602-and-interrupt-programming/m-p/243479#M2447</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I have two questions. I've developed a time stamping system in LabView
using the PCI 6602. I first created a single module that takes the
80MHz clock as input and uses my signal that I want to time stamp as
the clock. So I should get a time stamp resolution of 12.5 ns. Now
everything worked fine when I was using a slow (20Hz - 30Hz) pulse
train generator to test my program. But now that I'm ramping it up to
faster rates things start to be going haywire. When I test it with say
2000Hz it seems to run fine, but when I look at my output file there
are far fewer entries in it then 2000Hz would produce (there should be
2000 per second, it's not even close to that). If I go much higher the
program quits altogether. So my question is there a max sampling rate?
The website stated &lt;SPAN class="noindex"&gt;-&amp;gt; 80 MHz maximum source
frequency, I thought this was the max sampling rate. Is this correct?
If it does have a max sampling rate of 80MHz, why isn't my application
working at this rate? Is it a max sampling rate of 80MHz on each
counter channel? Or spread out among the 8 counter channels? I know
that once I'm above the 3 DMA channels that I'll have a slower transfer
rate to memory, but I was told that the counter should still record the
data. What's more, I'll probably have data rates of max ~100kHz, this
seems like it should be well within the counter limits. I was also told
that interrupts would probably almost be able to handle this rate in
real time too. I've posted my code and my tester application. Any help
would be appreciated.&lt;BR /&gt;
&lt;BR /&gt;
Second question is currently I have only 3 time stamping subVI's
running (because only 3 DMA channels), now I want to increase it to 8
time stampers so I'm going to have to program it to use interrupts. Any
good examples or resources to show me how to program the interrupts?&lt;BR /&gt;
&lt;BR /&gt;
Thanks for any help anyone can offer,&lt;BR /&gt;
Chris &lt;BR /&gt;
&lt;/SPAN&gt;&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 19 Jul 2005 19:11:46 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Counter-Timer/Max-sampling-rate-on-6602-and-interrupt-programming/m-p/243479#M2447</guid>
      <dc:creator>ChrisErven</dc:creator>
      <dc:date>2005-07-19T19:11:46Z</dc:date>
    </item>
    <item>
      <title>Re: Max sampling rate on 6602 and interrupt programming.</title>
      <link>https://ni.lithium.com/t5/Counter-Timer/Max-sampling-rate-on-6602-and-interrupt-programming/m-p/243867#M2456</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;P&gt;Hi again Chris, I think I remember you from a previous thread...&lt;/P&gt;
&lt;P&gt;I can't look at your code now b/c my internet PC and my LV PC are far from one another.&amp;nbsp; However I'll take a shot at addressing some of your questions.&lt;/P&gt;
&lt;DIV&gt;1. Sorry, but you can't expect to perform &lt;EM&gt;sampling&lt;/EM&gt; at 80 MHz.&amp;nbsp; It &lt;STRONG&gt;is&lt;/STRONG&gt; true that the hw counter will be able to detect TTL edges and increment its count register at an 80 MHz (12.5 nsec) rate.&amp;nbsp; That's the meaning of the 80 MHz source frequency spec.&amp;nbsp; However, you won't be able to sample the contents of that count register value at an 80 Mhz rate.&amp;nbsp; The sampling rate will depend on getting those count register values off the board and over the PCI bus into the PC's system memory.&amp;nbsp; This is (groan) system-dependent but I'd guess you might be able to handle&amp;nbsp;several 10's or&amp;nbsp;perhaps even 100&amp;nbsp;kHz&amp;nbsp;per channel using&amp;nbsp;DMA (available for&amp;nbsp;3 counters).&amp;nbsp; The next 5 counters would need to use interrupts, where you're likely going to be limited to single-digits of kHz each.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;2.&amp;nbsp; The method for programming interrupts is quite simple, though a bit obscure to find.&amp;nbsp; Essentially you will just add a single VI into your config chain where one of the input parameters specifies that you will use interrupts for data transfer.&amp;nbsp; That's all.&amp;nbsp; I don't recall exactly which VI it is at the moment, but can&amp;nbsp;check it out and reply later if no one else answers in the meantime.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;3.&amp;nbsp; You described data rates of ~100kHz.&amp;nbsp; If this is per-channel, you'll almost certainly have trouble with the interrupt-driven channels.&amp;nbsp; You may need to rethink the time-stamping.&amp;nbsp; As I recall, right now you are using the 80 Mhz clock as a Source and your photon detectors as Gates (sampling clocks), right?&amp;nbsp; This method will record the exact firing time for each photon.&amp;nbsp; Nice info, but lots of bandwidth required.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Can you consider a different measurement for your app?&amp;nbsp; One where you use the photon pulses as the Source and some other signal as the sampling clock?&amp;nbsp; You could probably sustain a 1 kHz sampling clock, and buffer up a bunch of "photons per millisecond" readings rather than timestaming every individual photon.&amp;nbsp; Just a thought to consider b/c I don't think you'll find long-term success with 100 kHz sampling using interrupts.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;-Kevin P.&lt;/DIV&gt;</description>
      <pubDate>Wed, 20 Jul 2005 14:45:55 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Counter-Timer/Max-sampling-rate-on-6602-and-interrupt-programming/m-p/243867#M2456</guid>
      <dc:creator>Kevin_Price</dc:creator>
      <dc:date>2005-07-20T14:45:55Z</dc:date>
    </item>
    <item>
      <title>Re: Max sampling rate on 6602 and interrupt programming.</title>
      <link>https://ni.lithium.com/t5/Counter-Timer/Max-sampling-rate-on-6602-and-interrupt-programming/m-p/244368#M2464</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;P&gt;Chris,&lt;/P&gt;
&lt;P&gt;Quick followup on DMA vs. interrupts.&amp;nbsp; In DAQmx, you can select it with a Channel Property node, though it takes some digging.&amp;nbsp; It's located at&amp;nbsp; DAQmx Channel Property--&amp;gt;Counter Input--&amp;gt;General Properties--&amp;gt;More--&amp;gt;Advanced--&amp;gt;Data Transfer and Memory--&amp;gt;Data Transfer Mechanism.&amp;nbsp; Whew!&lt;/P&gt;
&lt;P&gt;I made a little utility that allows you to request DMA by default, but on failure it will then try for Interrupts.&amp;nbsp; On return it tells you which mechanism succeeded (or -1 if neither).&amp;nbsp; And for symmetry's sake, if you request Interrupts it'll try for DMA on failure, though I'm not sure there's a real-world situation where that's likely to help.&lt;/P&gt;
&lt;P&gt;Here's the subvi which can be inserted into your config chain.&lt;/P&gt;
&lt;P&gt;-----Begin edit------&lt;/P&gt;
&lt;P&gt;One caveat -- I put this together on&amp;nbsp;a machine without DAQmx hardware.&amp;nbsp; I expect it to work, but let me know if it doesn't.&lt;/P&gt;
&lt;P&gt;-----End edit-----&lt;/P&gt;
&lt;P&gt;Kevin P.&lt;/P&gt;&lt;P&gt;Message Edited by Kevin Price on &lt;SPAN class="date_text"&gt;07-21-2005&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;08:31 AM&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2005 12:29:49 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Counter-Timer/Max-sampling-rate-on-6602-and-interrupt-programming/m-p/244368#M2464</guid>
      <dc:creator>Kevin_Price</dc:creator>
      <dc:date>2005-07-21T12:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: Max sampling rate on 6602 and interrupt programming.</title>
      <link>https://ni.lithium.com/t5/Counter-Timer/Max-sampling-rate-on-6602-and-interrupt-programming/m-p/244451#M2467</link>
      <description>&lt;SPAN class="noindex"&gt;Hi Kevin,&lt;BR /&gt;
&lt;BR /&gt;
Thanks for your help. The labview solution with PCI 6002 card is a
temporary solution. However, single digits of kHz should still be
worthwhile until we start our second solution (using an FPGA to
timestamp). However, I'm not getting even close to kHz. Currently
testing with the pulse train generators and only 3 counters going (so
they should all be DMA transfers) I get maybe 10 timestamps a second
from each channel. So I'm assuming something must definitely be wrong
to get so low a rate. Would changing the circular buffer size (samples
per channel on the DAQmx Timing.vi) or the number of samples to read at
once (a number used along with the property AvailSampPerChan to
determine when to read) have any effect? Any other ideas? Also when the
signal gets up in the 20kHz range rather then just being able to sample
say 50% of these the program dies, it doesn't read any samples. Any
ideas?&lt;BR /&gt;
&lt;BR /&gt;
Unfortunately, I can't really consider a different measurement for the
app. We're doing coincident measurements, so highly accurate time
stamps to tell which photons go together is a pair is necessary.&lt;BR /&gt;
&lt;BR /&gt;
&lt;/SPAN&gt;&lt;SPAN class="noindex"&gt;I'm going to try your suggestions on interrupt programming now.&lt;BR /&gt;
&lt;BR /&gt;
Thanks again,&lt;BR /&gt;
Chris&lt;BR /&gt;
&lt;/SPAN&gt;&lt;SPAN class="noindex"&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 21 Jul 2005 14:20:42 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Counter-Timer/Max-sampling-rate-on-6602-and-interrupt-programming/m-p/244451#M2467</guid>
      <dc:creator>ChrisErven</dc:creator>
      <dc:date>2005-07-21T14:20:42Z</dc:date>
    </item>
    <item>
      <title>Re: Max sampling rate on 6602 and interrupt programming.</title>
      <link>https://ni.lithium.com/t5/Counter-Timer/Max-sampling-rate-on-6602-and-interrupt-programming/m-p/244456#M2468</link>
      <description>Hi Kevin,&lt;BR /&gt;
&lt;BR /&gt;
One more quick question that I was thinking about. So when I mentioned
about the circular buffer size, the 6602 card has a buffer built onto
it? Do you know roughly how many events it can store? Sorry I guess
what I'm asking is how the sampling works. So what I'm thinking is, say
the 6602 has a buffer that can store 1000 samples. So if I wait until
there's 1000 samples there and then read from the card, then I'm
actually only doing a data transfer across the bus 1/1000th as much.
I'm just wondering if I can optimize how many samples are stored vs how
many times stuff is read for the card. Does any of that make sense? Or
have I misunderstood how the card and buffers, etc work?&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Chris&lt;BR /&gt;
&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 21 Jul 2005 14:24:43 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Counter-Timer/Max-sampling-rate-on-6602-and-interrupt-programming/m-p/244456#M2468</guid>
      <dc:creator>ChrisErven</dc:creator>
      <dc:date>2005-07-21T14:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: Max sampling rate on 6602 and interrupt programming.</title>
      <link>https://ni.lithium.com/t5/Counter-Timer/Max-sampling-rate-on-6602-and-interrupt-programming/m-p/244493#M2469</link>
      <description>Hi Kevin,&lt;BR /&gt;
&lt;BR /&gt;
Silly me, I think I found my error for why I have such a low data rate.
I went back and looked at my code which I wrote over a month ago, the
DAQmx read returns an array (the size I'm assuming is "the number of
samples to read at once" which I use with the AvailSampPerChan), for
whatever reason I didn't realize that this was an array of data, so
instead in my data processing loop I read only the first array element
(don't know why, wish I could kick my past self, since this problem has
been bugging me for days), instead there's usually a couple of hundred
data points in the array. Anyways, so I think I'll have that fixed,
I'll post a message if that isn't the problem. &lt;BR /&gt;
&lt;BR /&gt;
As for the interrupts, I'm playing with that now. Where exactly in my
setup should I be putting that subview, I tried putting it anywhere
before my call to DAQmx Start Task, but LabView is still complaining
about not enough DMA channels. I'll play with it some more, but if you
know exactly where I should be putting it, let me know.&lt;BR /&gt;
&lt;BR /&gt;
Thanks again for all your help,&lt;BR /&gt;
Chris&lt;BR /&gt;
&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 21 Jul 2005 15:10:24 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Counter-Timer/Max-sampling-rate-on-6602-and-interrupt-programming/m-p/244493#M2469</guid>
      <dc:creator>ChrisErven</dc:creator>
      <dc:date>2005-07-21T15:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: Max sampling rate on 6602 and interrupt programming.</title>
      <link>https://ni.lithium.com/t5/Counter-Timer/Max-sampling-rate-on-6602-and-interrupt-programming/m-p/244790#M2475</link>
      <description>Chris,&lt;BR /&gt;
I was looking at your post for awhile and playing around with the
counters on my E Series board.&amp;nbsp; I was able to achieve around 200
kHz reads on the counter before getting an error using DMA on a single
channel.&amp;nbsp; Using interrupts I was able to get around 20 kHz. You
may not be able to get this kind of speeds using multiple channel
counts, but I didn't test that.&lt;BR /&gt;
&lt;BR /&gt;
I believe the reason you may be still getting an error message using
the subVI that Kevin created is that it checks for an error, then
changes the data transfer mechanism if there is an error, however I
believe that an error won't be thrown until after the task starts, so
and I don't believe this is a property that is settable at run-time, so
you would need to simply use the property node that Kevin mentioned and
set the data transfer type to be 'Interrupts'.&amp;nbsp; This channel
propety node would be placed somewhere before the DAQmx Start Task
VI.&amp;nbsp; I hope this helps!&lt;BR /&gt;
&lt;BR /&gt;
Doug M&lt;BR /&gt;
Applications Engineer&lt;BR /&gt;
National Instruments&lt;BR /&gt;
&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 22 Jul 2005 01:58:14 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Counter-Timer/Max-sampling-rate-on-6602-and-interrupt-programming/m-p/244790#M2475</guid>
      <dc:creator>Doug M</dc:creator>
      <dc:date>2005-07-22T01:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: Max sampling rate on 6602 and interrupt programming.</title>
      <link>https://ni.lithium.com/t5/Counter-Timer/Max-sampling-rate-on-6602-and-interrupt-programming/m-p/245040#M2479</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;Chris,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;I'm going out on a limb here a little, but here goes:&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;You wrote:&amp;nbsp; &lt;EM&gt;"...Would changing the circular buffer size (samples per channel on the DAQmx Timing.vi) or the number of samples to read at once (a number used along with the property AvailSampPerChan to determine when to read) have any effect? Any other ideas?&lt;/EM&gt;"&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;There are two aspects to buffering.&amp;nbsp; One has to do with the DAQ board delivering samples from itself into system RAM, using either DMA or interrupts.&amp;nbsp; This is probably your most serious bottleneck.&amp;nbsp; However the other aspect has to do with your app issuing the DAQmx Read command to retrieve samples from the RAM buffer.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Changing the circular buffer size or the # to read at once will only affect the 2nd of these two aspects of buffering.&amp;nbsp; If the buffer is too small or you fail to retrieve data often/fast enough, the buffer will get overwritten.&amp;nbsp; The next time you do a default DAQmx Read, you'll get an error and no data back.&amp;nbsp; However, if you're setup for continuous sampling &lt;STRONG&gt;AND&lt;/STRONG&gt; you setup DAQmx Read Property node values ahead of time, it's possible to request the most recent samples.&amp;nbsp; In such a mode, the circular buffer can overwrite over and over, but at any time you can retrieve recent data without getting the error.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;However, I think your main problem at the moment is the DMA vs interrupt issue of &lt;EM&gt;filling&lt;/EM&gt; the buffer as fast as the samples come in.&amp;nbsp; I'm not personally aware of a workaround that will let you ignore this error and retrieve whatever data happens to get transferred successfully.&amp;nbsp; I suspect the driver is designed (rightfully) to prevent you from retrieving chunks of data that may be missing samples at various points.&amp;nbsp; Better to throw an error than to give you mysteriously wrong data...&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;P.S.&amp;nbsp; Sorry about the little subvi -- one of the hazards of submitting without testing on hw.&amp;nbsp; Doug M figured out the problem with it and gave a solution in this same thread.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;You wrote: &lt;EM&gt;"...So when I mentioned about the circular buffer size, the 6602 card has a buffer built onto it? Do you know roughly how many events it can store? ...&amp;nbsp; &lt;/EM&gt;&lt;EM&gt;say the 6602 has a buffer that can store 1000 samples. So if I wait until there's 1000 samples there and then read from the card, then I'm actually only doing a data transfer across the bus 1/1000th as much. I'm just wondering if I can optimize how many samples are stored vs how many times stuff is read for the card."&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;I don't know how the exact size, but I think the on-board buffer is pretty small.&amp;nbsp; However, when you issue a DAQmx Read command, you are &lt;EM&gt;not&lt;/EM&gt; reading directly from the board anyway.&amp;nbsp; You're reading from system RAM.&amp;nbsp; The DAQmx driver is busy behind the scenes making the board deliver its samples into system RAM for you, and I don't know of anything you can do from the app level to affect this.&amp;nbsp;&amp;nbsp; Errrr, wait a minute.&amp;nbsp; I might know of something after all.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Here's &lt;A href="http://forums.ni.com/ni/board/message?board.id=250&amp;amp;message.id=12990#M12990" target="_blank"&gt;another thread&lt;/A&gt; I got involved in a little while back.&amp;nbsp; It related to a different board doing Analog Output, but the "Data Transfer Request Condition" property just &lt;EM&gt;might&lt;/EM&gt; also be relevant for counter input operations.&amp;nbsp; Again, I'm not near hw to check it out.&amp;nbsp; &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://ni.lithium.com/i/smilies/16x16_smiley-sad.gif" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Hope this helps, &lt;/DIV&gt;
&lt;P&gt;-Kevin P.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jul 2005 14:04:13 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Counter-Timer/Max-sampling-rate-on-6602-and-interrupt-programming/m-p/245040#M2479</guid>
      <dc:creator>Kevin_Price</dc:creator>
      <dc:date>2005-07-22T14:04:13Z</dc:date>
    </item>
  </channel>
</rss>

