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

Real Time Clock Runs at Double Speed

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



Joined: 25 Nov 2009
Posts: 9
Location: Albuquerque NM

View user's profile Send private message

Real Time Clock Runs at Double Speed
PostPosted: Wed Nov 24, 2010 12:30 pm     Reply with quote

I'm setting up the real time clock in a 24HJ64GP202 using compiler 4.114 with the built in setup, read and write functions. All this works fine, I can set and read the clock. However the clock output, i.e., seconds, is running at two Hertz!

I've checked the oscillator and it measures 32,766 Hz so that is within tolerance. The oscillator pin signal is about 1.9 volts and I don't know what that voltage is supposed to be. On the scope the clock looks more like a rounded triangle wave than a sine wave but again I don't know what it is supposed to look like.

I looked in the Microchip 24F/H reference manual but didn't see anything there that helps.

Anyone with ideas?
_________________
Dave N
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Nov 24, 2010 2:05 pm     Reply with quote

What if the RTC only runs at the correct speed with a scope probe
attached to the crystal ? Did you test the RTC speed in that situation ?
dneale



Joined: 25 Nov 2009
Posts: 9
Location: Albuquerque NM

View user's profile Send private message

Real Time Clock Runs at Double Speed
PostPosted: Fri Nov 26, 2010 4:47 pm     Reply with quote

The clock output, as read by the software function, always runs at double speed regardless if the oscilloscope is connected to the XTAL output or not.

Dave
_________________
Dave N
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Nov 26, 2010 5:28 pm     Reply with quote

I don't have the PCD compiler, so I can't do my usual method of looking at
a test program. I'm not sure if I can help much more.
gpsmikey



Joined: 16 Nov 2010
Posts: 588
Location: Kirkland, WA

View user's profile Send private message

PostPosted: Fri Nov 26, 2010 5:31 pm     Reply with quote

Only thing that comes to mind here is the possibility that the setup routine in the compiler is wrong - what if you were do do the setup yourself - do you still get the same results ?

mikey
_________________
mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3
dneale



Joined: 25 Nov 2009
Posts: 9
Location: Albuquerque NM

View user's profile Send private message

PostPosted: Sun Nov 28, 2010 10:20 pm     Reply with quote

Good suggestion. I'll give that a try.

Thanks
_________________
Dave N
dneale



Joined: 25 Nov 2009
Posts: 9
Location: Albuquerque NM

View user's profile Send private message

Real Time Clock Runs at Double Speed: MOSTLY SOLVED
PostPosted: Wed Dec 15, 2010 8:04 am     Reply with quote

I took a longer measurement of the timing and discovered that the error was not exactly double. That led me to believe the problem was not in the software. The clock output scope photos from Microchip document TB097 and my clock output were somewhat different.

I adjusted (upward) the series capacitors and got a clock response close to the proper timing but the capacitor values were almost double what the Microchip, and PIC List equations predict is required. (For a 12.5 pF load the series cap should be about 22pF versus the 36 pF needed in my circuit.)

Using these low frequency crystals is not as simple as the higher frequency ones seem to be.

Does anyone have a favorite 32 kHz crystal type/manufacturer they have had success with?

Thanks
_________________
Dave N
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