View previous topic :: View next topic |
Author |
Message |
fredbor Guest
|
interrupt with MPLAB |
Posted: Sun Feb 01, 2004 1:59 pm |
|
|
Hello,
I am using a 16f628. I want an timer0 interrupt every 200 ?s, so i write:
set_timer0(56);
enable_interrupts(INT_TIMER0);
enable_interrupts(GLOBAL);
I compile my program and when i launch MPLAB and its debugger, the timer0 doesn't increment and so there is no interrupt. Why, please.
Thank you. |
|
|
Haplo
Joined: 06 Sep 2003 Posts: 659 Location: Sydney, Australia
|
|
Posted: Sun Feb 01, 2004 4:26 pm |
|
|
You have to use setup_timer_0() to set it up initially. For example setup_timer_0 (RTCC_INTERNAL | RTCC_DIV_2); |
|
|
fredbor Guest
|
interrupt with MPLAB |
Posted: Sun Feb 01, 2004 4:40 pm |
|
|
Haplo wrote: | You have to use setup_timer_0() to set it up initially. For example setup_timer_0 (RTCC_INTERNAL | RTCC_DIV_2); |
Sorry,
i use setup_timer_0(RTCC_DIV_1);
but it doesn't work.
My code for the timer0 is:
setup_timer_0(RTCC_DIV_1);
set_timer0(56);
enable_interrupts(INT_TIMER0);
enable_interrupts(GLOBAL);
It doesn't work in MPLAB and in my project. Why??
Thank you |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Mon Feb 02, 2004 6:52 am |
|
|
Post a small test program that shows your problem. You might not have the interrupt coded right but we can't tell without seeing the code. |
|
|
|