View previous topic :: View next topic |
Author |
Message |
MAY Guest
|
PROBLEM WITH RB INTERRUPT |
Posted: Fri Nov 13, 2009 4:38 am |
|
|
Hi all
I am having a problem with this code using RB interrupt.
#include <16F877A.h>
#FUSES XT, NOWDT, LVP, NOPUT, NOPROTECT, BROWNOUT
#use delay(clock=4000000)
#INT_RB
void RB_isr ( )
{
output_d(INPUT_B());
}
void main()
{
set_tris_b(0xff);
set_tris_d(0x00);
enable_interrupts(INT_RB);
enable_interrupts(GLOBAL);
do { } while(True);
}
When I run it using Isis simulator it works fine but on the actual circuit it doesn't. I tried a simple program on my circuit and it works, so I assume my connections are fine.
Is there something missing in the code?
Please help me ... |
|
|
May Guest
|
|
Posted: Fri Nov 13, 2009 4:54 am |
|
|
I'm really sorry I didn't use the "Code" feature. I couldn't edit my post.
sorry again. |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Fri Nov 13, 2009 5:35 am |
|
|
The code seems correct except for one detail. You should never enable LVP, when the respective programming pins are used as I/O. |
|
|
|