Hi Jim,
> Unfortunately the duty cycle of the source is not a perfectly symmetrical square wave although I believe it to be of a constant duty cycle.
As long as the duty cycle is fixed it doesn't have to be 50%, if you know the dutycycle ratio is 37% or whatever it would be enough to measure either the positive or negative half of the cycle and then calculate the period time. However, if the dutycycle isn't fixed then it obvoiusly won't work. The code I posted above measures a complete cycle so it doesn't matter if the dutycycle changes, as long as it stays within reason (like 5-95% or something).
> I have done some research on Darryl Taylors routines and am trying to fit this into what I am learning. Thank you for sending me in that direction.
Yes, Darrels routines are by far the easiest/best way to get PBP interrupts going without having to live with the limitations of ON INTERRUPT. I initially tried using DT-INTS and another aproach on the 12F675 but unfortunately the device doesn't have enough RAM, that's why I ended up with the code I posted. So if you're going to use DT-INTS pick a PIC with more RAM then 12F675.
> 1 us is more than enough resolution one update per input cycle would be great. However, I am more concerned in the lag time in the propagation at such low frequencies.
1us is the resoultion of the timer generating the outputting frequency, because the software (in the code above) polls the interrupt flag as it loops around the "accuarcy" will be less than 1us. With the above code the output changes ~1.5 cycles after the input changes, it doesn't matter if the frequency is 10Hz or 2000Hz. So if you have a steady input of 10Hz and it instantly changes to 11Hz there will be a delay of (1/11)*1.5=136ms before the output changes from 20 to 22Hz.
That 1.5 cycle delay is worst case, it depends on "where" during the cycle the input frequency actually changes. If the input happens to change just before the measruement is going to start the delay will be ~1 cycle instead.
Again, all this is with the above code, if you go for a PIC with a CCP module you can probably get that down to 1 cycle and if you "decide" that the dutycycle isn't going to change then perhaps it could be 1/2 cycle.
There are a lot of ways of doing this, it's just a matter of deciding which one fits the purpose best.
/Henrik.
Bookmarks