We needed digital quadrature counter to keep track of a high speed 20 nano-meter encoder. Our system is a cRIO-9074 using a Ni-9411 differential module. All the examples found would miss counts or did not include error detection for missed encoder counts. A state machine was used here to detect if a quadrature states were skipped.
I am quite new to LabVIEW and neglected to follow LabVIEW data flow rules by putting this sub.vi loop inside a while loop on the main vi. This vi would run beautifully on its own but was not passing information to the main loop as this loop is meant to run infinitely to never miss counts. Ultimately I decided to move the entire SCTL to the main loop. However, using global variables inside the SCTL would make the main code cleaner and the example attached uses global variables to pass data in/out of the SCTL.
This code was pieced together from other encoder example and digital filter examples. I'm open to other suggestions and tips and don't pretend to be an expert with LabVIEW FPGA after a few weeks of use.