CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Timing issues

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Guest








Timing issues
PostPosted: Fri Feb 29, 2008 10:52 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Feb 29, 2008 10:58 am     Reply with quote

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

View user's profile Send private message

Re: Timing issues
PostPosted: Fri Feb 29, 2008 1:01 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Feb 29, 2008 2:58 pm     Reply with quote

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

View user's profile Send private message

Re: Timing issues
PostPosted: Fri Feb 29, 2008 4:34 pm     Reply with quote

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








PostPosted: Fri Feb 29, 2008 7:01 pm     Reply with quote

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?
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group