Square Waveform counter with PXI Series R

Updated Mar 20, 2018

Reported In


  • PXI Multifunction Reconfigurable I/O Module


  • LabVIEW FPGA Module

Issue Details

I would like to evaluate if  I can detect a 24 Mhz square wave in order to implement a counter. Implementing a counter does not require to perfectly rebuild the waveform (which would require a sampling rate greater than the signal frequency of at least a factor of 7), but it is enough to detect the change of value from high to low. 


You have to implement a simple FPGA code that generate and acquire the square waveform (you can use a loopback configuration) and you need to derive two clock from the main 40 Mhz clock of the FPGA: 
You have to use the 48 Mhz clock to generate the 24 Mhz square waveform: 

You use reference clock which is double with respect to the square waveform to generate because on each tick you need to change the status. You will generate a finite number of period in order to check if the number acquired periods is the same of the generated periods.
Then you'll need to use the other clock (200 Mhz is an arbitrary value, but in generally you should use a clock higher than the waveform you need to acquire) to acquire the waveform and count the periods: 

If the number of the indicator will be 100 (in the example 100 is an arbitrary number) it means that you detected all the periods that you generated.


Not Helpful