Datasheet page 6 (table 1, pin allocation table), shows INT is on RA2 and has quite a few other peripherals attached; are you confident you aren't driving the pin from any of those other peripherals in the chip? I'd be worried about SRQ, C1OUT, and CCP3, per section 12.2.3. Figure 12-1, Generic I/O Port Operation, doesn't show how peripherals output to a shared pin. I've no recent experience to share. Interesting note on page 124, are you changing the input threshold selection INLVLA at all? If so, expect spurious input. Reference: http://datasheet.octopart.com/PIC16F1828-I/SS-Microchip-datasheet-12511458.= pdf On Wed, Dec 23, 2015 at 02:36:39PM +1100, K S wrote: > Hi list. >=20 > Apologies, I accidentally sent a truncated message prior to this one. >=20 > I have a 100Hz square wave (from rectified mains) driving the INT0 pin on= a > 16F1828. I'm after interrupts on a single edge only - don't care whether > rising or falling. >=20 > I can do this (v1) in my INT0 interrupt routine and it works as expected: >=20 > InterruptIntPin > BANKSEL OPTION_REG > ;determine polarity of egde > btfsc OPTION_REG,INTEDG > goto InterruptIntPinRising > InterruptIntPinFalling > bsf OPTION_REG,INTEDG > ;next interrupt on rising edge > BANKSEL 0 > goto InterruptIntPinEnd > InterruptIntPinRising > bcf OPTION_REG,INTEDG > ;next interrupt on falling edge > BANKSEL 0 > ;do stuff here > InterruptIntPinEnd > bcf INTCON,INTF > ;allow INT interrupts again > retfie >=20 > but if I do this (v2) it follows both edges on INT0: >=20 > InterruptIntPin > BANKSEL 0 > ;do stuff here > bcf INTCON,INTF > ;allow INT interrupts again > retfie >=20 > That makes no sense to me. V2 should only be invoked on a single edge, no= t > both. No other changing of OPTION_REG occurs anywhere else. >=20 > Does anyone have any idea why this may be happening? >=20 > Cheers. Kris. >=20 >=20 >=20 > On Wed, Dec 23, 2015 at 2:29 PM, K S wrote: >=20 > > I have a 100Hz square wave driving the INT0 pin on a 16F1828. I'm after > > interrupts on a single edge only - don't care whether rising or falling= .. > > > > I can do this in my INT0 interrupt routine and it works as expected: > > > > InterruptIntPin > > BANKSEL OPTION_REG > > ;determine polarity of egde > > btfsc OPTION_REG,INTEDG > > goto InterruptIntPinRising > > InterruptIntPinFalling > > bsf OPTION_REG,INTEDG > > ;next interrupt on rising edge > > BANKSEL 0 > > goto InterruptIntPinEnd > > InterruptIntPinRising > > bcf OPTION_REG,INTEDG > > ;next interrupt on falling edge > > BANKSEL 0 > > > > incf R_PSUPeaksCounter,F > > ;increment the peak counter > > bsf B_INTSignalDetected > > > > > > > --=20 > http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist --=20 James Cameron http://quozl.netrek.org/ --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .