Yes the spec for the 16F84 says you have to
make a read of PORTB and
THEN
Clear the interrupt flag
Note: BOTH!
I've done this inside the ISR and it's fine.
movf PORTB,w
bcf INTCON,XXX ; Clear pending interrupt flag
Don't quote me on the "XXX" bit I cannot remember the exact flag, it's
something like RBE ?. It's in the register descriptions. Note there's one
flag in the register to turn the interrupt on (RBE ?) and one which
indicates a pending interrupt. You need to turn the interrupt on once in the
background main loop of your code and then clear the pending flag each time
the interrupt service routine is called.
Also remember that the interrupt vector table calls only one function upon
interrupt (the goto at address 04). You have to read the status of the
interrupts and determine where it came from :-)
Hope that helped.
Pete
{Quote hidden}> > My interrupt routine only runs once. After powering up, the
> > instruction
> > works fine once, the next time a interrupt occurs the PC doesn't go
> > to
> > 04h, but the main routine keeps running. Is this normal for a
> > RB0/INT-port
> > on a 16f84 ? I use the RB0/INT-port because i can detect a falling
> > edge
> > (rs-232 startbit) there.
> >
> > Milan.
--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics