On Sat, Sep 12, 2009 at 4:33 AM, cdb wrote: > Why not, XOR the port bit in the ISR routine and not only save some > typing, but also have the function in one place., or set a flag in the > ISR and then XOR the port bit in your main code? I did modify the code to have the ISR set a flag alone, rather than to do any PORT I/O The actual PORT I/O i do it in the indefinite loop. Also changed the LED orientation, just to avoid the initial state of PORTA being 0 and the LED to flash for a very short time at POWER up. RB.0/INT pin is left unconnected to anything So this is what i would expect: no interrupts, since RB0 is left unconnected and hence LED doesn't light up. Provide a trigger on RB0, LED lights for a short period and goes off. But results do show otherwise: on power up, LED is off, all is well. i provide a trigger, high or low on RB.0 nothing happens. LED is off all the time whatever i do. Seems like the interrupt is not triggered ? Still finding no clue on what's happening .. Any clues ? Thanks PROCESSOR 16f72 #include "p16f72.inc" __CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _HS_OSC loopus_a EQU 0x2d loopms_a EQU 0x2e loopms_b EQU 0x2f loopms_c EQU 0x30 flags EQU 0x31 LEDPORT equ PORTA LEDBIT equ 1 org 0x0 goto init org 0x4 goto isr #include "delays.inc" init clrf flags banksel TRISA movlw 0x06 movwf ADCON1 movlw 0x00 ; Port A output movwf TRISA movlw 0x01 ; RB.0 int movwf TRISB banksel OPTION_REG bcf OPTION_REG, INTEDG ; falling edge int bsf OPTION_REG, NOT_RBPU ; disable pullup bsf INTCON, INTE ; enable RB.0 int bsf INTCON, GIE ; global int banksel LEDPORT main btfsc flags, LEDBIT bsf LEDPORT, LEDBIT ; LED on movlw 0xff call delay_ms bcf LEDPORT, LEDBIT ; LED off movlw 0xff call delay_ms clrf flags ; clear all flags goto main isr bcf INTCON, INTF bsf flags, LEDBIT retfie END -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist