Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Overwrite CI Freq samples issue

Now that I have a better understanding of the problem, here is a modified example that has the same issue as my acre-sized Labview program. Note that in my program I have buffered AI reads that are recording multiple data points per loop iteration. I need to run buffered frequency measurements (which requires Implicit timing) so that I can check if there is an available sample in the frequency buffer. This check allows me to input very low frequencies (like 1 Hz) and if there is no available point, I just use the point(s) provided in the last loop iteration. This allows the loop to continue without waiting for a calculation of very low frequency inputs. Otherwise my loop waits for a frequency point to become available and my AI gets bogged down.

So I'm stuck with buffered frequency measurements to deal with low input frequencies, this works great for low frequencies. When I put in high frequencies, like 1000Hz, 10000Hz, etc I get an error that says that the task was stopped because there was un-read data in the buffer - seeming to ignore the "Overwrite Unread Samples" request. Why won't this overwrite the samples that accumulate at high frequencies.

Also note that if I remove Implicit timing and don't do buffered acquisition, the high frequencies work great. Then I have a problem with low frequencies…

I can't change modes based on input frequencies. I don't want to increase the AI rate based on input frequency. There must be a way to ignore (overwrite) the extra frequency samples without getting an error???

0 Kudos
Message 1 of 6
(3,639 Views)
Hi Bsmyth,

This is an interesting problem and might have several solutions. Since you are familiar with DAQmx property nodes, we can keep on using them.
You are right that "overwrite" seems not to work but this is because we are not reading from the point we should. We will need to read samples that are before the last one acquired. In other words, set the RelativeTo DAQmx Read property to "Most Recent Sample" and set the Offset property to a negative number indicating how many samples you want to pull from the buffer.
I have modified and tested your program here with those modifications.
Hope this helps,
Gerardo O.
RF SW Engineering R&D
National Instruments
0 Kudos
Message 2 of 6
(3,627 Views)
Thanks for your time.  Unfortunately you have a newer version of Lab View than I, is there any way you can save it so that my 7.1 can open it?  Attach a jpg?  FYI, I'm also working with another application engineer at NI but we haven't yet had a discussion since I posted this VI.  Nonetheless, I'm very interested in viewing your VI if I can.
 
Thanks.
0 Kudos
Message 3 of 6
(3,622 Views)
Hi Bsmyth,

Here is the code for LabVIEW 7.1. Please let the other application engineer about this so we can join support forces and make sure this question is answered for you and for other customers visiting the forums.
Gerardo O.
RF SW Engineering R&D
National Instruments
0 Kudos
Message 4 of 6
(3,609 Views)

I'm still getting an error with this VI.  See below...

In non-buffered mode the card usefully reads frequencies much higher than I require. In this mode, is there any way to keep the acquire loop from waiting for a sample at low frequencies (lower than the acquire frequency)? I can time-out the frequency read and keep the loop going but when it times-out it doesn't just allow the loop to continue and still calculate the frequency, it resets the read and must "re-start" the frequency calculation on the next iteration. It there any way to replicate my necessary functionality with this card? We have a lot of investment in this direction. Can the 6210 even control an SCXI?

Thanks,

Brian

-----Original Message-----

From: support@ni.com [mailto:support@ni.com]

Hello Brian.

I have replicated the issue that you are seeing with the PCMCIA card and this is expected behavior. The reason is that the PCMCIA card uses IRQ transfer which is much slower than the PCI method of using DMA transfers.

The IRQ transfer method, combined with the 2 sample FIFO on the PCMCIA makes measuring higher frequencies without the use of 2 counters impossible.

At this point, I would recommend purchasing a USB-6210, which has a 1024 sample counter FIFO instead of the 2 sample FIFO that is on your PCMCIA card. Also, the 6210 uses DMA instead of IRQ which will greatly increase the performance of your system.

0 Kudos
Message 5 of 6
(3,598 Views)
Hi Bsmyth,

Let me address the full problem so that other customers understand the entire problem and our decisions in the programming style we choose.

Problem Statement

How to measure high frequencies and low frequencies on the same task and without waiting for the read to return.
The immediate solution is to use buffered counting and just take the last element. Then, if it’s a low frequency use the time out to return and we can keep the old value. Although this is a working solution, it is not the case for non DMA devices such as PCMCIA. This device cannot do high frequency buffered measurements since it is using interrupts to transfer data to the PC.

This is why we used the following architecture:
This VI is using notifiers to know if there has been an updated value of the frequency. The main idea is to have one loop waiting for that value to come where the second loop will use this value.

Gerardo O.
RF SW Engineering R&D
National Instruments
0 Kudos
Message 6 of 6
(3,584 Views)