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

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



Joined: 15 Dec 2011
Posts: 20

View user's profile Send private message

Real time clock
PostPosted: Fri Dec 30, 2011 3:24 am     Reply with quote

Hallo

I need to implement time stamping with data being captured, using a pic16f690, can anybody tell me what the easiest way would be, do I need to get an external chip for date and time, or do you normally create a "watch" with the internal timer on the pic?

Regards,
Labjac
temtronic



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

View user's profile Send private message

PostPosted: Fri Dec 30, 2011 6:23 am     Reply with quote

It all depends on how the PIC will be used.

A software clock,like ..
http://www.ccsinfo.com/forum/viewtopic.php?t=26177 ( hope it's the correct link). is a nice tight(small code) ISR driven 'real time clock', but has to be setup everytime the PIC is powered up. Either manually with real data or just stuff zeros in (making it more of an elapsed time clock).
It costs you nothing just some code, and can be plain(time only) or fancy(time,date,dow). But it does take time( ISR) to make it run.

A hardware clock, like the DS1307(my choice) requires a battery,xtal,space but is more 'stable' in the long run. It may require more code( the driver) as it's an I2C device,2 I/O pins.

I've done both and chose the DS1307 for all my products.Today PICs have lots of pins, tons of memory and low cost so there's no real reason to not use the hardware solution. I use the software I2C driver from here and a big coin cell battery good for 10-12 years. Spend an extra 50c on a better 'watch' crystal and the timing is bang on. I use the 1 Hz o/p of the DS1307 to trigger a tight ISR and that's the 'heartbeat' for a lot of my projects.

Simple, cheap, reliable and 100% transportable to any other PIC in future projects.

I suggest you try both. Code the software one while waiting for the DS1307 to arrive and then code for the DS1307. Compare code space required and 'flexibility' for your requirement.

Neither choice is 'wrong' it's which one is better for you that is 'right'.
Labjac



Joined: 15 Dec 2011
Posts: 20

View user's profile Send private message

PostPosted: Sat Dec 31, 2011 5:12 am     Reply with quote

Thanks

I ordered the chip and will start with internal timers soon.

Regards,
Labjac
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