Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
April 25, 2024, 09:06:27 09:06


Login with username, password and session length


Pages: [1]
Print
Author Topic: loading capacitors  (Read 2485 times)
0 Members and 1 Guest are viewing this topic.
planet69
Newbie
*
Offline Offline

Posts: 26

Thank You
-Given: 5
-Receive: 8


« on: December 12, 2007, 03:39:22 03:39 »

i'm using PIC18F452 for a project and had written codes in C with CCS
the calculation i've done for my timer0 interrupt is as follows,
11059200/4=2764800;
2764800/256(8-bit TMR0 register)=10800
10800/16(pre-scaler)=675
therefore, i need to count up to 675, a good round figure for one sec timing
every 1 sec bit generated is accumulated in the main program
my system will generate an output every 24 hours, but i find that this system actually triggers an output about 5-6 seconds earlier every single day. For example, a counter increments from 1 to 86400 (total seconds in a single day) beginning from actual time of 12.00.00 am, and when the total of 86400 overflows, i'm getting an output at 11.59.55 p.m rather than the intended 12.00.00 am   
and this is my code for high priority interrupt. there is no other part whereby the interrupt is disabled.
Code:
#INT_TIMER0 FAST			//Change to fast context saving			
void ISR_TMR0 (void)     //High priority
{        //triggers every 1.48ms
if (++cnt_sec_timeup == 675) //Execute process list
{
bit_timeout_1s = 1;      //set 1s task
cnt_sec_timeup = 0;
}
bit_timeout_1ms = 1;
if (++cnt_1ms == 7)    //triggers every 10.3ms
{
bit_timeout_10ms = 1;   //set 10ms task
cnt_1ms = 0;
}
}
with crystal 11.0592MHz, i'm able to generate an exact 1second timing theoretically but the as i've found out it actually doesn't so i've put up my enquiry at CCS forum and the boys had come to conclusion that this error is due to the incorrect loading capacitors used. well, i've used a pair of 15pF earlier and i have finally reduced the error to as little as +1 sec difference in two days with a pair of 27pF caps.
i've done some research over the internet regarding loading capacitors, and an article from Microchip is very helpful
the formula they've used to calculate the estimate values to use is as folllows
Cloading = ((C1*C2)/(C1+C2)) + Cstray
what i want know is how do we measure Cstray on the PCB? information has it estimated as 5 to 15pf
Logged
neelandan
Newbie
*
Offline Offline

Posts: 15

Thank You
-Given: 6
-Receive: 3


WWW
« Reply #1 on: December 12, 2007, 07:19:56 07:19 »

There is no easy way.

If you have some means of measuring low capacitors you might try connecting the unloaded board to it and measuring it.

The stray capacitance includes that of the pins of the ic, and this is different between powered / unpowered conditions.

In situations requiring exact timing (as for time-of-day clocks) the usual solution is a trimmer capacitor on one of the pins of the crystal.
Logged

Deep inside the carcass of a dead (short) circuit.
planet69
Newbie
*
Offline Offline

Posts: 26

Thank You
-Given: 5
-Receive: 8


« Reply #2 on: January 17, 2008, 02:53:45 02:53 »

am using a pair of 22pF to which the 24-hour period has been consistently accurate for the past 3 weeks and counting
 Smiley
Logged
iphone
Active Member
***
Offline Offline

Posts: 168

Thank You
-Given: 115
-Receive: 10


« Reply #3 on: January 17, 2008, 04:20:28 04:20 »

am using a pair of 22pF to which the 24-hour period has been consistently accurate for the past 3 weeks and counting
 Smiley

What the crystal value and at what speed that you run ( ie with HSPLL) ?
Logged
planet69
Newbie
*
Offline Offline

Posts: 26

Thank You
-Given: 5
-Receive: 8


« Reply #4 on: January 17, 2008, 05:10:01 05:10 »

the info u want is in my first post
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC