If your interrupt is at Zero-Cross, then it simply jumps to any of your TIMER registers, reads the current value and resets it to Zero ready for the next period. You've a shed-load of Timers to chose from in most PICs, and which one you use (8 or 16-bit) will depend on the frequency of your measured wave. You will have a few uS error (the time taken to jump to the interrupt and read the clock) which can be mitigated by how good your coding is... PICs with PWM module also have CCP... this is called a CAPTURE COMPARE MODULE which again (depending on your wave period) could be a better bet than starting/stopping Timer Registers yourself. Read all about it in your PICs Datasheet.
Bookmarks