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

Problem with Timer1 using PIC18F26J11

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



Joined: 06 May 2010
Posts: 33

View user's profile Send private message

Problem with Timer1 using PIC18F26J11
PostPosted: Fri Jul 09, 2010 12:39 am     Reply with quote

Hi,
I'm having some problems using this PIC. I'm not able to make the timer1 overflow and thus the interruption never happens. I'm using CCS compiler v4.093 and may be its something wrong in the header file or something not defined because this PIC has 2 configuration registers for the timer.
I have checked the same code with other PIC 18F8722 and there is no problems with the timer. I'm doing something like:
Code:

enable_interrupts(INT_TIMER1);             
setup_timer_1(T1_INTERNAL|T1_DIV_BY_8); 
set_timer1(0xDF72);                           
enable_interrupts(int_rda);
enable_interrupts(global);

and the interruption is defined:
Code:

#int_timer1
void timer1_isr(){
temporizador=1;
set_timer1(0xDF72);
}

Timer1 in header file is defined:
Code:

Timer 1 Functions: SETUP_TIMER_1, GET_TIMER1, SET_TIMER1
// Constants used for SETUP_TIMER_1() are:
//      (or (via |) together constants from each group)
#define T1_DISABLED         0
#define T1_INTERNAL         0x85
#define T1_EXTERNAL         0x87
#define T1_EXTERNAL_SYNC    0x83

#define T1_CLK_OUT          8

#define T1_DIV_BY_1         0
#define T1_DIV_BY_2         0x10
#define T1_DIV_BY_4         0x20
#define T1_DIV_BY_8         0x30

I suspect the problem could be in this header file. Thanks for the help.
Wayne_



Joined: 10 Oct 2007
Posts: 681

View user's profile Send private message

PostPosted: Fri Jul 09, 2010 1:54 am     Reply with quote

I suspect the problem is in how you are checking or displaying that the interrupt has fired!

How are you debugging this ?
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