04-11-2014 02:45 PM
Hi,
I have a rio kit (sbrio-9636) and i have to read the time between two pulses given by an optical sensor on a shaft to calculate the speed. I'm familar with microcontroller where i can do that with timer and interrupt but don't know how to do that in labview with an FPGA. Any help ?
04-14-2014 12:14 PM
Interrupts would not make as much sense here since the FPGA doesn't execute code in the same way a regular CPU would, and doesn't need to "interrupt" execution whenever some event occurs.
Since FPGAs give you the ability to control how logic executes all the way down to a single tick of the FPGA's clock, you could easily just write some code that starts counting ticks of the FPGA clock in a Single-Cycle Timed Loop when the first pulse is read, and then stop counting when the second pulse is read. This count multiplied by the duration of each tick (25ns for a 40MHz clock) would give you the total duration between pulses.
FPGA does have interrupts, but these are more for synchronizing the FPGA with a Real-Time process. If you are interested, there are FPGA Intperrupt examples in the LabVIEW Example Finder.
I hope this helps.
Regards,
Ryan