Why putting a goto ISR at the ISR entry point and not the code. Do you handle the interrupt correct? Harry > -----Oorspronkelijk bericht----- > Van: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] > Namens Manu Abraham > Verzonden: zaterdag 12 september 2009 1:08 > Aan: piclist@mit.edu > Onderwerp: [PIC] RB0/INT behaving different than expected ? > > Hi, > > > I have the following code. When i do power up, all i do see > is that the LED on RA.1 is lit up after ~250mS What i had > been expecting was an edge on RA.1 to light up the LED for ~ > 250mS. ie the code looping within main and a subsequent > interrupt causes the LED to be cleared (switched ON) and with > the return from the ISR back to the main loop with a delay of > 250 mS, the LED is set (switched OFF) > > I can't seem to find what i am doing wrong. Can someone > please point out what i am possibly doing wrong ? > > 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 0x2f > > > LEDPORT equ PORTA > LEDBIT equ 1 > > org 0x0 > goto init > > org 0x4 > goto isr > > #include "delays.inc" > > init > 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 > > main > banksel LEDPORT > movlw 0xff > call delay_ms > bsf LEDPORT, LEDBIT ; LED off > movlw 0xff > call delay_ms > goto main > > isr > banksel LEDPORT > bcf INTCON, INTF > bcf LEDPORT, 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 > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist