View Single Post
  #2   Spotlight this post!  
Unread 11-02-2014, 19:36
calcmogul's Avatar
calcmogul calcmogul is offline
WPILib Developer
AKA: Tyler Veness
FRC #3512 (Spartatroniks)
Team Role: Mentor
 
Join Date: Nov 2011
Rookie Year: 2012
Location: Santa Maria, CA
Posts: 52
calcmogul is just really nicecalcmogul is just really nicecalcmogul is just really nicecalcmogul is just really nice
Re: Digital input lag!

Rather than using a DigitalInput, I recommend using a Counter instead. It counts up all of the pulses coming from a DIO for you in the FPGA.

In C++, the RPM can be found with "60.0/GetPeriod()" where GetPeriod() is a function in the Counter class which returns the time between pulses in seconds. If there is more than one pulse per revolution, you would use "60.0/(pulsesPerRev * GetPeriod())".

That's the general idea, but the implementation varies depending on which language you are using.
Reply With Quote