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

timer 3 is never getting executed? must be something simple

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







timer 3 is never getting executed? must be something simple
PostPosted: Sat Dec 03, 2005 6:19 pm     Reply with quote

This code is for a pic18f4455 with 4 built in timers and one ccp module.

I'n trying to use timer 3 as a simple counter, but when i noticed it wasnt counting I added a printf.. and nothing shows up. so I must have messed up somewhere. Anyone have an idea of what i did wrong,

Thanks Nick

Code:

#int_timer3
void counter()
{
static int32 delay=0;
     printf(usb_cdc_putc,"\n\rAlive...\n\r");   
rise++;
delay++;
if (delay ==10)
{
count++;
delay=0;
}
}



Code:

   delay_ms(2000);

   setup_ccp1(CCP_CAPTURE_RE);    // Configure CCP1 to capture rise
   setup_timer_3(T3_DIV_BY_8);

   enable_interrupts(INT_TIMER3);//constantly counting but only used for RPM
   enable_interrupts(INT_CCP1);   // Setup interrupt on falling edge
   enable_interrupts(INT_TIMER1);//constantly counting but only used for RPM
   enable_interrupts(GLOBAL);

main loop....
Nick
Guest







PostPosted: Sat Dec 03, 2005 7:11 pm     Reply with quote

I moved to timer_0 and it worked, i must be missing a concept here?

Nick
drh



Joined: 12 Jul 2004
Posts: 192
Location: Hemet, California USA

View user's profile Send private message

PostPosted: Sat Dec 03, 2005 9:20 pm     Reply with quote

Change:
setup_timer_3(T3_DIV_BY_8);

To:
setup_timer_3(T3_INTERNAL | T3_DIV_BY_8);
_________________
David
Nick
Guest







thanks
PostPosted: Sun Dec 04, 2005 1:45 pm     Reply with quote

thanks for the tip
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