OK, as usual, the act of thinking about and typing my question has brought to light an idea.
Since I'm already running an interrupt, how about doing away all together with the PULSIN command and doing the equivalent checking/testing commands within the interrupt? It all boils down to how frequently I check, but at each interrupt I could get the value of the input port and compare it to its previous value. If I found a low->high transition I could zero a counter variable, then when it went from high->low I could read the counter and determine the width. As I said before, the resolution of my measurement would depend on how frequently I checked, but for my application variance within 5% or so would be acceptable.
It seems like this would be a little "too" easy... am I missing something? Would there be a reason to take multiple samples of the incoming signal?
I'm going to give this method a shot, but would still appreciate any input. Something like this has to have been done before...
Thanks,
Jeff
Bookmarks