The FPGA "Dynamic" Period/Frequency Measurement code allows users to perform Period/Frequency on incoming digital signals. This functionality is commonly used for Control Applications where we need that type of information at a certain refresh-rates (periodically, ideally independently from incoming signal period/frequency). Of course, Frequency/period measurement capability was already available, it's just an alternative that could be a better fit in some scenarios (but certainly not all), depending on your requirements.
The document referred below gives a good overview of the typical techniques used for Period/Frequency measurements. For each, you have the pros/cons and it's used a comparison reference.
Making Accurate Frequency Measurements
The present example, in this post, gives another option, which is a variant of the Technique #3, referred in the document above. The goal is to get a measurement refreshed at a user-configurable rate but also get the "'maximum" of accuracy at that refresh-rate.
The main idea is to accumulate the maximum number of periods of incoming signals inside the Refresh-rate period. In present example, we accumulate up to 32 periods of incoming signal and we compute period value based on that. The 32 value could be changed to accommodate different requirements.
Here are some conditions you may face and how the FPGA code behaves. For illustration purpose, the incoming signal varies between 1 Hz-50 kHz, update-rate configured to 1 ms, timeout set to 2 seconds (2000 ms):
What can we expect (in terms of actual accuracy, actual refresh-rate) with that technique if we vary something? I created the Excel Spreadsheet joined here. Where it's really not fully validated. it's supposed to summarize respective performances for the 4 techniques: the 3 from the document referred above plus the one (variant from #3) we are proposing here. There are always variations from one customer to another.
To the question: why is "dynamic" word used? It's simply to highlight that the fact that, based on conditions, the number of periods accumulated varies dynamically to try to accommodate settings.
Where NI-VeriStand applications can be a good candidate as a user, it's not limited to NI-VeriStand as what is proposed is more a LabVIEW FPGA code with User-Defined Variables (UDVs) to configure the personality and get measurements.
The Add-on is not a "ready-to-use" in a sense that you need to adapt it to your needs (in terms of number of measurement channels, maximum number of periods accumulated, flexibility you want to give,...) AND also compile it for your FPGA target.
The code embeds a generation part to allow validation and it's, of course, not required for the measurement part (it can be removed).
The code comes with source for a NI-9025 cRIO Controller, a NI-9118 chassis and a NI-9401 digital IO module.
To use the (name of add-on) add-on, unzip the add-on files and place them in (correct directory based on add-on type).
Once compiled the code could be used along with NI VeriStand Add-On - Scan Engine and EtherCAT.
This device was created for use with NI VeriStand 2014 (LabVIEW 2014 actually). To compile the code, you need:
This add-on requires the following hardware.
This add-on is provided as open-source software. If it does not meet your exact specification, you are encouraged to modify the source code to meet your needs. It is not officially supported by National Instruments.
If you encounter a problem with this add-on, or if you have suggestions for a future revision, please post to the forum for this add-on FPGA "Dynamic" Period/Frequency Measurement Feedback Forum. You must use this feedback forum for support. Do not call National Instruments for support for this add-on.
National Instruments does not support this code or guarantee its quality in any way. THIS EXAMPLE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).