|
|
View previous topic :: View next topic |
Author |
Message |
ceegb2 Guest
|
Timer2 causing Resets |
Posted: Thu Jul 15, 2004 7:40 am |
|
|
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 |
Posted: Thu Jul 15, 2004 8:32 am |
|
|
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
|
|
Posted: Thu Jul 15, 2004 9:55 am |
|
|
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
|
|
Posted: Thu Jul 15, 2004 3:38 pm |
|
|
If you are using timer2 ONLY with the PWM module, you don't need to enable the timer 2 interrupt or service that interrupt. |
|
|
|
|
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
|