PDA

View Full Version : 16F88 Interrupt



sskeet
- 24th January 2006, 01:13
Trying to get my interrupt RB0 pin to accept a rising edge interrupt, but no matter what it keeps expecting a falling edge...anyone know what i am doing wrong?

The code works if I ground RB0 (it triggers the interrupt), but I want the interrupt to trigger when 5v is applied (rising edge).

--------------

@ DEVICE INTRC_OSC, LVP_OFF, WDT_OFF, MCLR_OFF

DEFINE OSC 8

OSCCON = %01110000 ' INTRC = 8MHz

OPTION_REG.6=1 'Trigger on rising edge
INTCON = %10010000 'Enable INTE
INTCON.1 = 0 'Clear RB0/INT External Interrupt Flag bit

On Interrupt Goto UpdateCounter

PORTB=0
Pause 500 ' Wait for startup
LOW PORTB.3

loop:

HIGH PORTB.4
Pause 2000 ' Wait 5 second

LOW PORTB.4
Pause 2000 ' Wait 5 second
Goto loop ' Do it forever

Disable
UpdateCounter:
LOW PORTB.4
HIGH PORTB.3
pause 2000
LOW PORTB.3

INTCON.1=0 're-enable interrupts

resume
ENABLE
GOTO loop

END

Dave
- 24th January 2006, 12:02
sskeet, What kind of input is triggering the interrupt? Digital or Switch? Are you sure the input edge is clean? It mey be triggering on switch bounce if you are using a push button or switch.

Dave Purola,
N8NTA

sskeet
- 24th January 2006, 15:51
sskeet, What kind of input is triggering the interrupt? Digital or Switch? Are you sure the input edge is clean? It mey be triggering on switch bounce if you are using a push button or switch.

Dave Purola,
N8NTA
Sorry I finally figured it out last night, i had to add a pull-down resistor to the pin.