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 CCS Technical Support

Timer 0 external crystal

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



Joined: 25 Apr 2011
Posts: 297

View user's profile Send private message

Timer 0 external crystal
PostPosted: Sat Nov 16, 2019 10:28 am     Reply with quote

Dear all, i would like to make an external 32.768khz external crystal to my pic 18f1220 on pin ra4. Is there a circuit how i can convert the 32.768khz to this pin?
temtronic



Joined: 01 Jul 2010
Posts: 9226
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Nov 16, 2019 10:43 am     Reply with quote

Several methods, some recently posted on this forum.

You'll need the xtal, a 10M resistor, 1/6th of a 4069, and 2, 12-20pfd caps.

Probably google '4069 clock oscillator' for a schematic and 1,000s of 'hits'.
Jay
aaronik19



Joined: 25 Apr 2011
Posts: 297

View user's profile Send private message

PostPosted: Sat Nov 16, 2019 10:46 am     Reply with quote

Thanks because i googled for 32khz crystal circuit....thanks for this hint. Is the dalllas semiconductor ds32k chip offers any advantages maybe you have experience on it
Ttelmah



Joined: 11 Mar 2010
Posts: 19515

View user's profile Send private message

PostPosted: Sat Nov 16, 2019 10:55 am     Reply with quote

You would need to build an external oscillator circuit. This pin requires a
clock fed in.
Timer 1, instead does offer you an internal oscillator using pins RB6 &
RB7 This is easier.
An external oscillator can be built using a transistor, or a CMOS inverter
gate:
<https://www.diodes.com/design/support/perspective/crystal-oscillators-simple-low-cost-and-highly-accurate-clock-sources/>
<http://www.circuitdiagramworld.com/oscillator_circuit_diagram/Crystal_Oscillator_Circuit_15296.html>
Alternatively consider buying a 32KHz oscillator, rather than just a
crystal.

<https://www.sitime.com/products/32-khz-oscillators/sit1533>

There are literally hundreds of such modules.
Ttelmah



Joined: 11 Mar 2010
Posts: 19515

View user's profile Send private message

PostPosted: Sat Nov 16, 2019 11:01 am     Reply with quote

The Dallas module offers better accuracy than a simple crystal. This is
a TCXO. Temperature compensated xtal oscillator. It automatically adjusts
for changes in temperature to give perhaps 10* better accuracy than
a simple crystal. Better than 1 minute a year timekeeping over normal
temperature ranges. A simple crystal will onlyh manage about 10minutes
a year....
temtronic



Joined: 01 Jul 2010
Posts: 9226
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Nov 16, 2019 11:52 am     Reply with quote

Probably doesn't want to spend MORE than the PIC costs ! $2 PIC,
I have to assume he can't reconfigure his PIC either ..
Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19515

View user's profile Send private message

PostPosted: Sat Nov 16, 2019 12:46 pm     Reply with quote

He came back and asked about the DS32K, while we were both typing.
Hence my duplication of a lot of what you said, and then my separate
answer about this module.
temtronic



Joined: 01 Jul 2010
Posts: 9226
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Nov 17, 2019 6:19 am     Reply with quote

I use a $3 module that has both a DS3231 and an EEPROM. Far better time keeping than the DS1307 I used to use, though less RAM. I've never used the 32KHz signal, instead have the SQW configured for 1Hz. I use this to interrupt the PIC, great for updating the LCD time, triggering other sensors, etc. While the EEPROM is fairly small, it's GREAT for storing 'setup' configurations, like GPS location (for sunrise/set calculations).

These days I add modules instead of parts. Modules are cheaper and they WORK ! Don't have to debug bad solder traces, wrong pins, etc.
Jay
aaronik19



Joined: 25 Apr 2011
Posts: 297

View user's profile Send private message

PostPosted: Sun Nov 17, 2019 7:34 am     Reply with quote

Temtronic, infact i was going to mention this one as well. It is a good idea to use a breakdown board and you have the facility of an external eeprom in a very small space on one bus system. I did not mention it because i might give the impression that i want to avoid building circuits.
temtronic



Joined: 01 Jul 2010
Posts: 9226
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Nov 17, 2019 7:44 am     Reply with quote

the older I get (66+) the more I like modules. At least those I can SEE, unlike the itty-bitty sub-micro size chips of today !
Ttelmah



Joined: 11 Mar 2010
Posts: 19515

View user's profile Send private message

PostPosted: Sun Nov 17, 2019 8:10 am     Reply with quote

Generally 'RTC' chips are very nice additions to a system. I prefer the
ones that give a small amount of NVRAM, since for a lot of applications
having memory that can be written without having to worry about 'lives'
is very useful. With just two I2C lines, adding a chip like a DS1338, and a
separate EEPROM, gives you so many abilities. Going back over thirty
years I was using RTC chips giving 1/second ticks as the 'heartbeat'
of systems. Couple of my recent systems have used the DS3232M. Lovely,
since it incorporates the oscillator, and gives better accuracy than you are
likely to achieve unless you sped time to actually 'trim' a normal crystal.
Give a couple of minutes a year accuracy (actually much better than this if
the temperature range is reasonable). Unfortunately this one is 'itty bitty',
but in only an 8pin package it is still quite easy to hand solder. Smile
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