nicherbert
Member
I think the best way is to always reference your total accumulator and do math on that value. So, if you use a Modulo math function on the accumulator and 1440, the remainder will always be a fraction of that. This way, you will never lose an accumulated value. You can also use these same remainder function to determine the precise angle each cycle in a much simpler fashion I believe. As for the RPM, you can compute the delta in accumulator each PLC scan and compare the value. Hopefully you have access to the last scan time of the PLC as well, and you can take the delta and scan time to determine the Rate Per Scan. Multiple this out to your RPM and average over a few scans (say 1 second or more). I think that should work.