This simple program uses the FPGA on a myRio to detect the edges of a square-wave and sets a times to measure the period (number of samples between the positive going edges of the waveform). It is accurate from a few Hz up to 80kHz. A video goes with this.
https://www.youtube.com/watch?v=Fz4GIb455YY&feature=youtu.be
Top is the FPGA code and below is the host code that runs on the real-time processor.
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
Hello. I have tried this code and also watched your youtube video. I am trying to get the spped from my quadrature encoder. I have converted the frequency code to velocity measurement code as seen in your video. I am getting the reading but it is fluctuating very rapidly in y axis. My motor is running at 1000 rpm and I am getting other rpms along with 1000 rpm in waveform window. The video of speed measurement is below.
Please help me.
Thankyou
Hello. I have tried this code and also watched your youtube video. I am trying to get the spped from my quadrature encoder. I have converted the frequency code to velocity measurement code as seen in your video. I am getting the reading but it is fluctuating very rapidly in y axis. My motor is running at 1000 rpm and I am getting other rpms along with 1000 rpm in waveform window. The video of speed measurement is below.
Thankyou
You could try increasing the sampling frequency. That is probably the problem.
Thank you Tomnz. I will try it.