> -----Original Message----- > From: Larry Bradley [SMTP:lhbradley@IGS.NET] > Sent: Tuesday, April 22, 2003 10:30 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: CCP compare function > > I'm trying to use the CCP module on a 628 to generate 10ms interrupts. > I've > done this before using timer1, preloading it with a value then reloading > in > the interrupt routine. It works, but I thought I would try it with the CCP > module, since it isn't necessary to keep reloading the timer in the > interrupt routine. > > Using a 20 mHz xtal, setting the CCP registers to 50,000 should generate > an > interrupt every 10 msec. I use the interrupt to accumulate hours, mins and > seconds for a time-of-day clocks. When I compare the time from the PIC > with the time from my GPS, over about 14 hours, my time is about 7 seconds > too fast. Changing the CCP value to 50007 makes the clock track the GPS > time just fine. > > The xtal is a nominal 25 ppm device - this could account for 1 or 2 counts > in 50000, but not 7, I wouldn't think > > Has anyone else played with timer1 and the CCP in this fashion? > The first thing I would suspect is that you don't have the correct capacitors on each leg of the crystal and it's oscillating slightly off frequency. The only way you can reliably measure this (without potentialy affecting xtal frequency) is by making a very simple main loop that simply toggles an output every X instructions, and then measuring that output with a frequency counter. Regards Mike ======================================================================= This e-mail is intended for the person it is addressed to only. The information contained in it may be confidential and/or protected by law. If you are not the intended recipient of this message, you must not make any use of this information, or copy or show it to any person. Please contact us immediately to tell us that you have received this e-mail, and return the original to us. Any use, forwarding, printing or copying of this message is strictly prohibited. No part of this message can be considered a request for goods or services. ======================================================================= Any questions about Bookham's E-Mail service should be directed to postmaster@bookham.com. -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics