08-30-2007 01:58 PM
08-31-2007 02:08 PM - edited 08-31-2007 02:08 PM
Hello Ralph,
Every time you run the while loop in your example, you are creating and clearing the task. This method can become a little inefficient. Normally you would want to create the task before you enter into the loop and then clear the task after you leave the loop. Each iteration of the loop will then read in the frequency value from the counter.
Do you know the frequency of this noise? You can create an external hardware filter that will eliminate this noise. The problem with creating a filter is that a square wave consists of a lot of frequencies summed together. Applying a simple low pass filter to your square wave, will not necessarily eliminate this problem and might degrade your square wave.
I would suggest using a digital filter on the counter input. This means that your square wave must be at least so long in order for it be counted. This might help eliminate your high frequency noise. I have included an example of a simple VI that might help you. Here is a great KnowledgeBase on how to implement Digital Filters on Counters.
Let me know if you have anymore questions on this issue.
Message Edited by Robert F on 08-31-2007 02:12 PM
09-02-2007 11:07 AM
09-04-2007
03:36 PM
- last edited on
10-01-2025
01:17 PM
by
Content Cleaner
Hello Ralph,
You would still want to develop your main application so that you only create/configure and stop/clear the task once. If you are trying to acquire the frequency data and manipulate that information, then I would suggest maybe Master/Slave or Producer/Consumer architecture.
These architectures would allow you to have two parallel loops. One is acquiring the data and the other is manipulating the data. They are able to work independently of each. The only difference is how they send data from one loop to the other.
Master/Slave uses notifiers to send data between loops. This data type can only save one element at a time. Only the most recent data will be passed between loops. If you do not grab the data fast enough in your second loop, you might loose some data. (This might be acceptable for your application)
Producer/Consumer uses queues to send data between loops. This data type will allow you store multiple data. It is a First In First Out FIFO queue. This architecture is really good if you have a long data manipulation process. It will allow you to collect data, while manipulating the data without overwriting the buffer on the DAQ.
In order to read the frequencies on three different counters just change the channel constant. Here is an example of a channel constant that will read from four counters.
Message Edited by Robert F on 09-04-2007 03:36 PM