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

setup_timer0 and set_timer0 function problem for ccs compile

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








setup_timer0 and set_timer0 function problem for ccs compile
PostPosted: Fri Dec 19, 2008 9:31 pm     Reply with quote

Hi All,

I have been trying to use timer0 as arbitrary timer to generate different delay.
I created a function as below:
Code:
int delay(int16 timer_val, int8 prescaler) {

setup_timer_0(RTCC_INTERNAL|prescaler);  //!setup timer0
clear_interrupt(INT_RTCC);
enable_interrupts(INT_RTCC);                 
set_timer0(timer_val);
}

Function call:
Code:
delay(0x7d0,RTCC_DIV_1);

and it didn't work; the timer interrupt never fires.
Then I tried timer_val as int32 and it didn't work either.
But I do function without any parameter passing and it works, and interrupt fires.
Code:

void delay() {
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);  //!setup timer0
clear_interrupt(INT_RTCC);
enable_interrupts(INT_RTCC);                 
set_timer0(0x7D0);
}

Is it CCS compiler problem or am I doing something wrong?

Thanks in advance.

Regards:
nehal
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Dec 20, 2008 1:59 am     Reply with quote

1. Post your PIC.

2. Post your compiler version.
Charlie U



Joined: 09 Sep 2003
Posts: 183
Location: Somewhere under water in the Great Lakes

View user's profile Send private message

PostPosted: Sat Dec 20, 2008 5:29 pm     Reply with quote

This problem has been stumbled over before. Check out the following post and see if it applies:

http://www.ccsinfo.com/forum/viewtopic.php?t=34095&highlight=
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