Some ideas ...
Hi, Coyote
1) Did you try to use HIGH Portx.y ...
I noticed many times it is much more reliable than Portx.y = 1 in disturbed circuits ...
2) @ 20 Mhz, you also could try PULSIN instead of count ( as it is a square wave )... nominal result will be 20 ... and there will be a little less "rollover" issues ...
3) The ideal way would be to use the "capture" feature of the CCP modules ... in a '877 there are two modules !! ...
Darrel's instant interrupts are ... the easy way ... to make that. And it takes much, much, much less CPU time ...
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Bookmarks