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

Timer2 causing Resets

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







Timer2 causing Resets
PostPosted: Thu Jul 15, 2004 7:40 am     Reply with quote

Hi,

I've got a problem with timer 2 on PIC18F8720, 20Mhz Clk.
I only use it for PWM outputs.

I set it up as:
setup_timer_2(T2_DIV_BY_1,0x65,1);

and when it gets called on an interrrupt :

#INT_TIMER2
void time_increment(void)
{
//do nothing
}


So nothing should happen when it gets called, just use dfor PWM o/p.
However, randomly when I get data in on the USART it causes the PIC to Reset. It is completly random, may be after the 2nd command comes in or after the 200th. All I know is when I comment out all code to do with timer 2 the PIC is fine.

I'm currently on CCSV3.129.

Any ideas or anyone had a similiar problem?

Thanks

Graham Bremner


CS V3.129
Ttelmah
Guest







Re: Timer2 causing Resets
PostPosted: Thu Jul 15, 2004 8:32 am     Reply with quote

ceegb2 wrote:
Hi,

I've got a problem with timer 2 on PIC18F8720, 20Mhz Clk.
I only use it for PWM outputs.

I set it up as:
setup_timer_2(T2_DIV_BY_1,0x65,1);

and when it gets called on an interrrupt :

#INT_TIMER2
void time_increment(void)
{
//do nothing
}


So nothing should happen when it gets called, just use dfor PWM o/p.
However, randomly when I get data in on the USART it causes the PIC to Reset. It is completly random, may be after the 2nd command comes in or after the 200th. All I know is when I comment out all code to do with timer 2 the PIC is fine.

I'm currently on CCSV3.129.

Any ideas or anyone had a similiar problem?

Thanks

Graham Bremner


CS V3.129

I'd suspect you are just trying to push too fast. You are programming an interrupt every 65 instruction cycles. The overhead to call and return from an interrupt handler, on the larger 18x chips, is typically 70 or more instructions....
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Thu Jul 15, 2004 9:55 am     Reply with quote

Could your serial interrupt (assuming you are using a hardware UART) be interfering with your PWM interrupts causing you duty cycle to stay ON too long and causing power supply problems, leading to a RESET?
_________________
The search for better is endless. Instead simply find very good and get the job done.
drh



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

View user's profile Send private message

PostPosted: Thu Jul 15, 2004 3:38 pm     Reply with quote

If you are using timer2 ONLY with the PWM module, you don't need to enable the timer 2 interrupt or service that interrupt.
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