Well, as accurate as a watch crystal is.
Finally got round to trying to make an 18X work with Timer1 using a watch crystal, and it seems to work fine. Demo code to follow when I've done some more testing.
The magic is a watch crystal connected to O6 and O7 ( no caps used ), turn on Timer1 with an external LP Osc source and see it roll. By checking bit 15 changes of Timer1 a LED can be toggled every 1 second, bit 14 gives a 1Hz output.
Using CCP1, any arbitrary period up to 16 seconds can be polled or can generate a hardware interrupt, just like Timer1 was used for 18X multi-tasking.
Should be as accurate as a DS1307, and gives the capability of sub-second timing. Endless possibilities here, from 1Hz reference sources to single chip LCD clocks. Timer1 should also work through SLEEP mode so reasonably accurate wake-and-do-something every N seconds or sleep again code becomes a possibility.
[Added]
I was hoping this would work on the 08M, 14M, 18 and 18A ( the datasheets suggest it should ), but it only has on the 18A and 18X so far :-(
Edited by - hippy on 12/06/2007 04:31:09
[Added]
It doesn't seem to work through NAP on an 18X, but it does work when under-clocked by poking OSCCON, but not at maximum under-clocking.
Edited by - hippy on 12/06/2007 05:01:26
Finally got round to trying to make an 18X work with Timer1 using a watch crystal, and it seems to work fine. Demo code to follow when I've done some more testing.
The magic is a watch crystal connected to O6 and O7 ( no caps used ), turn on Timer1 with an external LP Osc source and see it roll. By checking bit 15 changes of Timer1 a LED can be toggled every 1 second, bit 14 gives a 1Hz output.
Using CCP1, any arbitrary period up to 16 seconds can be polled or can generate a hardware interrupt, just like Timer1 was used for 18X multi-tasking.
Should be as accurate as a DS1307, and gives the capability of sub-second timing. Endless possibilities here, from 1Hz reference sources to single chip LCD clocks. Timer1 should also work through SLEEP mode so reasonably accurate wake-and-do-something every N seconds or sleep again code becomes a possibility.
[Added]
I was hoping this would work on the 08M, 14M, 18 and 18A ( the datasheets suggest it should ), but it only has on the 18A and 18X so far :-(
Edited by - hippy on 12/06/2007 04:31:09
[Added]
It doesn't seem to work through NAP on an 18X, but it does work when under-clocked by poking OSCCON, but not at maximum under-clocking.
Edited by - hippy on 12/06/2007 05:01:26