Hi, i am trying to get a external interrupt working in the PIC16F690, the code seems to be ok, but when i try simulating the program in the mplab sim it just jumps straight to the ISR holds there for a while and then jumps to the infinite loop.
i am using Hi tech C compiler, and trying to just toggle the PORTB on the external interrupt, but a am at a loss as to why its not working . . . .
any help will be greatly appreciated
i am using Hi tech C compiler, and trying to just toggle the PORTB on the external interrupt, but a am at a loss as to why its not working . . . .
any help will be greatly appreciated
Code:
#include <htc.h>
#include "delay.h"
//------------------------------------
void main(void) @0x00
{
//Initialisation
TRISA=0xFF;
TRISB=0x00;
TRISC=0x00;
PORTA=0xFF;
PORTB=0x00;
PORTC=0x00;
ANSEL=0x00;
ANSELH=0x00;
WPUB=0x00;
GIE=1;
INTEDG=1;
PEIE=1;
INTE=1;
while(1)
{
PORTC=0x05;
DelayMs(20);
PORTC=0x06;
DelayMs(20);
PORTC=0x0A;
DelayMs(20);
PORTC=0x09;
DelayMs(20);
}
return;
}
//Interrupt Handler
static void interrupt int_handler(void) @ 0x10
{
if ((INTF&&INTE))
{
PORTB=0XFF^PORTB;
INTF=0;
}
return;
}