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

Zero Drift RTC by: Neutone

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



Joined: 07 Sep 2003
Posts: 51

View user's profile Send private message Yahoo Messenger

Zero Drift RTC by: Neutone
PostPosted: Sun Dec 21, 2003 9:04 pm     Reply with quote

Mabuhay!

Anybody in the forum who can provide me with the code snippet of the zero drift RTC by: neutone..

I do search the forum unfortuntely, the links is an error... I guess it was posted on the old forum...

Thank u
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Mon Dec 22, 2003 4:58 am     Reply with quote

http://www.ccsinfo.com/forum/viewtopic.php?t=11449&highlight=zero+drift+rtc
Neutone



Joined: 08 Sep 2003
Posts: 839
Location: Houston

View user's profile Send private message

Re: Zero Drift RTC by: Neutone
PostPosted: Mon Dec 22, 2003 8:58 am     Reply with quote

rrb011270 wrote:
Mabuhay!

Anybody in the forum who can provide me with the code snippet of the zero drift RTC by: neutone..

I do search the forum unfortuntely, the links is an error... I guess it was posted on the old forum...

Thank u


Code:

/*********************************************
*    Initialize RTC                          *
*********************************************/
void Initialize_RTC(void)
{  Ticker = XTAL_FREQUENCY;
   setup_timer_2 ( T2_DIV_BY_4, 0xff, 4 );   // initialize 8 bit counter/timer 2 to interupt every 16384 clock cycles
   enable_interrupts( INT_TIMER2 );          // Start RTC
}

// Global Real Time Clock Information
#int_TIMER2                                  // Clock interrupt adjusted to occurs ~ 1ms
void TIMER2_isr()                            //  -=Process Zero Drift Real Time Clock Information=-
{  tickmSec = 1;                             // set each MS very approximately
   Ticker -= 16384;                          // Decrement ticker by clocks per interupt
   if ( Ticker < 16384 )                     // If second has expired
   {  Ticker += XTAL_FREQUENCY;              // Increment ticker by clocks per second
      second++;                              // Increment number of seconds
      tickSec = 1;                           // set each Second very accuratly
   }
}
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