View previous topic :: View next topic |
Author |
Message |
Guest
|
Timing issues |
Posted: Fri Feb 29, 2008 10:52 am |
|
|
Im programming 16F688s with version 4.058
I have several identical boards running identical code. Every second, I pulse an LED. If I watch two board's LEDs, there is drift between the two flashes, and they eventually become out of sync with each other. Essentially, a second to one PIC is shorter than a second to the other. Im running at 125kHz, which is on the high frequency internal oscillator that is calibrated at the factory. Im also running the boards on battery power, so Vcc is slightly different on each board. Any ideas as to why this is happening? |
|
|
Ken Johnson
Joined: 23 Mar 2006 Posts: 197 Location: Lewisburg, WV
|
|
Posted: Fri Feb 29, 2008 10:58 am |
|
|
Although your boards and pics are "the same", they are not identical. Even with a precision external clock source, you'll see this happen, although it may take longer to notice.
If the boards must stay in sync, you'll need some signal to sync to.
Ken |
|
|
Neutone
Joined: 08 Sep 2003 Posts: 839 Location: Houston
|
Re: Timing issues |
Posted: Fri Feb 29, 2008 1:01 pm |
|
|
Anonymous wrote: | Im programming 16F688s with version 4.058
I have several identical boards running identical code. Every second, I pulse an LED. If I watch two board's LEDs, there is drift between the two flashes, and they eventually become out of sync with each other. Essentially, a second to one PIC is shorter than a second to the other. Im running at 125kHz, which is on the high frequency internal oscillator that is calibrated at the factory. Im also running the boards on battery power, so Vcc is slightly different on each board. Any ideas as to why this is happening? |
Most crystals are rated in PPM of tolerance. 10PPM is a normal rating equivalent to +- 0.001%. How long does it take to drift a second? |
|
|
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Fri Feb 29, 2008 2:58 pm |
|
|
Everything that is made has a 'tolerance'. One PIC might take a day to drift one second and another one might take a month to drift the same amount. You could have 10 boards made up the exact same way and each would drift at a different rate.
Ronald
Last edited by rnielsen on Fri Feb 29, 2008 4:51 pm; edited 1 time in total |
|
|
RLScott
Joined: 10 Jul 2007 Posts: 465
|
Re: Timing issues |
Posted: Fri Feb 29, 2008 4:34 pm |
|
|
Anonymous wrote: | ...which is on the high frequency internal oscillator that is calibrated at the factory... |
Yes, it is calibrated at the factory, but only to within 1% or so. It is entirely reasonable to see the 1-second pulses drift 1/2 sec. out of phase in only 50 seconds.
Robert Scott
Real-Time Specialties |
|
|
Guest
|
|
Posted: Fri Feb 29, 2008 7:01 pm |
|
|
I found the two boards that drifted the quickest. Every 22.5 seconds, the boards also transmit a wireless signal to another PIC that outputs the packets to a PC. The receiver times this 22.5 seconds with a resolution of 50 ms. The two transmitters were 5 ticks, or about 250 ms apart. According to the datasheet, at 8MHz, Vcc=3.5V, there is a 1% tolerance, or 7.92 to 8.08. I assume the 1% would also be true for 125kHz, which is my clock speed. The boards are also battery operated, with 3.2V batteries. I usually replace the batteries at 2.6V. 250ms is 1.11% of 22.5 seconds. With my Vcc a little low, I can only realistically expect a 2% tolerance. Is my math right? |
|
|
|