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

DS1302 digital clock with PIC16F887
Goto page Previous  1, 2, 3, 4
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Mon Apr 16, 2012 5:03 am     Reply with quote

princejude wrote:
The clock does not retain time. That is, if I ON the clock, set time, leave it ON for some time, OFF it, restart it: the time will start from initial value.
This doesn't surprise me when your code is still the same as posted earlier:
Code:
void main()
{
   rtc_init();   
   rtc_set_datetime(8,3,12,5,7,59);
Here you _always_ set the time on startup.

You have several options to fix this:
1) Do not set the time to a default value. The user will see the time is incorrect and will manually correct it once.
2) Read the time from the RTC before you set it on startup. If the time read is newer than your default time, then do nothing.
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Tue Apr 17, 2012 2:24 am     Reply with quote

You seem surprised that the common-base works!

Mike
princejude



Joined: 07 Aug 2010
Posts: 72

View user's profile Send private message

PostPosted: Tue Apr 17, 2012 6:35 am     Reply with quote

Quote:
You seem surprised that the common-base works!

Yeah! What even surprised me most was transistor circuit without BASE-RESISTOR
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Tue Apr 17, 2012 8:30 am     Reply with quote

princejude wrote:
Quote:
You seem surprised that the common-base works!

Yeah! What even surprised me most was transistor circuit without BASE-RESISTOR

It is a standard current driver configuration. The emitter resistor fills the usual role of the base resistor, plus it sets the drive current fairly independent of transistor gain.
_________________
The search for better is endless. Instead simply find very good and get the job done.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2, 3, 4
Page 4 of 4

 
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