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

INT_RTCC RTCC timer0 going too slow on 18F2520

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



Joined: 21 Nov 2006
Posts: 129

View user's profile Send private message

INT_RTCC RTCC timer0 going too slow on 18F2520
PostPosted: Mon Apr 23, 2007 10:27 am     Reply with quote

Hi,

On a 18F2520, with the latest version compiler (4.030), I can't seem to get the timer0 interrupt (INT_RTCC) to give the expected results. I have it set up like this:

Code:
setup_timer_0( RTCC_INTERNAL );
enable_interrupts(INT_RTCC);
enable_interrupts(GLOBAL);


I've tried variations of the setup_timer0 function using various combinations like:

Code:
setup_timer_0( RTCC_INTERNAL | RTCC_DIV_2);


and

Code:
setup_timer_0( RTCC_INTERNAL | RTCC_DIV_128 );


I'm using a 8mHz clock.

The higher divisors do slow the interrupt down, but the fastest setting (the first chunk of code with only RTCC_INTERNAL, no scalers), interrupts at about 14Hz. I would expect *much* faster.

Any ideas of what I could be doing wrong?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Apr 23, 2007 11:22 am     Reply with quote

The timer is being configured in 16-bit mode. You're probably expecting
it to be in 8-bit mode. In CCS, you have to explicitly put it in that mode.
Example:
Code:
setup_timer_0( RTCC_INTERNAL | RTCC_8_BIT );
evsource



Joined: 21 Nov 2006
Posts: 129

View user's profile Send private message

PostPosted: Mon Apr 23, 2007 3:50 pm     Reply with quote

PCM programmer wrote:
The timer is being configured in 16-bit mode. You're probably expecting
it to be in 8-bit mode. In CCS, you have to explicitly put it in that mode.
Example:
Code:
setup_timer_0( RTCC_INTERNAL | RTCC_8_BIT );


That was it. Thanks!
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