I have been using 20MHZ xtal's on 18f's..... just straight crystal no r or c's. I make 10 hz interrupts and main program loops on that, toggle blinks a heart-beat led at 10x/sec and no pauses in in code, just use counts of 100ms to do 'tasks'. so to check the timing, I did a serout of simple counter (using longs) once each 10 loops which is 1 serout per second. Then when I start up the pic along with a clock on my pc, and check after 1 or 2 or 5 or 60 minutes, the seconds should sync with time elapsed in seconds, for example after 60 minutes count should be 3600. I found it amazingly accurate using timer 1 and preload. Then all the programming and work is done in the loops or in other interrupts. I also get a % reading of the pic's usage or idle amount using the main loop.
![]()
Bookmarks