On Sun, May 08, 2005 at 04:13:23PM +0100, Dave Turner wrote: > Firstly, I'm not running off battery power. So counting power line ticks is a possibility. > After much fiddling with > config bits I have discovered that with the PIC running on XT mode, it > runs a lot faster than it should if it is using the 32.768KHz clock. > Also, on INTRC mode it runs too fast. On EXTRC, LP or HS mode it > doesn't run at all. There's no need for you to run the system clock from the 32 Khz. Run it from the 8 Mhz INTRC and use the 32 Khz to clock Timer 1. > The reason I'm trying to use the 32.768KHz clock as the system clock > is that I don't have a clue how to make a delay by checking a clock - > The only method I know is many embedded loops. My sunrise/sunset contoller implements a full 365 day calendar using a 2 second timer 1 heartbeat. Check it out here: http://www.finitesite.com/d3jsys/clock.asm > > Any pointers to good tutorials / examples about using a non-system > clock for a 1 second delay would be extremely welcome. It's a two second delay but the idea is sound. You implement it with a simple state machine. In a single big loop you increment the smallest value. When that overflows, you reset that value and increment the next one higher up. Check out the code for more details. BAJ -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist