Thanks for the tip. I'll remove those BANKSEL statements. I had been tinkering with the code adding here and there trying to figure out what I had done, they were added when I thought maybe I needed them. I poked BSF/BCF an LED until I found the DECFSZ isn't skipping ever. I tried the following code in two 16F1509 microcontrollers and the PORTC, 2 goes high and stays high (and I swap the BCF/BSF around and it follows)... so some how I have this DECFSZ broken. I'll simulate it tomorrow and see if I can find out what I did wrong. errorlevel -230, -302, -303, -313 LIST R=3DDEC #include "p16f1509.inc" __CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_OFF & _CLKOUTEN_OF= F __CONFIG _CONFIG2, _LVP_OFF & _STVREN_ON cblock int_delay1 int_delay2 endc RES_VECT CODE 0x0000 ; processor reset vector GOTO START ; go to beginning of program MAIN_PROG CODE ; let linker place main program INIT: ;RC5 =3D PWM1 BANKSEL LATA ;Data Latch CLRF LATA ; BANKSEL ANSELC ; CLRF ANSELC ;Digital IO BANKSEL PORTC ; BCF PORTC,5 ;Clear PWM1 BANKSEL TRISC ;Set all PORTC to outputs CLRF TRISC BANKSEL OSCCON MOVLW 0x78 ;16MHZ Clock MOVWF OSCCON RETURN START CALL INIT BANKSEL int_delay1 MOVLW 0x01 MOVWF int_delay1 BSF PORTC,2 OLOOP NOP BANKSEL int_delay1 DECFSZ int_delay1,1 GOTO OLOOP BCF PORTC,2 NOP LOOP: NOP GOTO LOOP ;loop forever END On Mon, Sep 30, 2013 at 7:01 PM, IVP wrote: > > Thank you, I had a sloppy CLRF INTCON .. I just changed it to > > BCF INTCON,T0IF ... no change. > > Hmmmm > > You don't really have to call delay1 (as is), seems unnecessary to > reload OPTION each time, plus there's its included bank change > > Maybe simplify, just CALL T0_OVFL_WAIT and remove the two > BANKSEL int_delay1. It's possible there's a banksel problem > > Keep this as a separate call, needs using only once > > BANKSEL TMR0 > CLRF TMR0 > CLRF INTCON ;INTCON is in all banks, no need to banksel > BANKSEL OPTION_REG ; Bank1 > MOVLW 0xC3 ; PortB pull-ups are disabled, > MOVWF OPTION_REG > BANKSEL int_delay1 > RETURN > > ;------------- > > delay2 > MOVLW 0x01 > MOVWF int_delay1 > OLOOP > CALL T0_OVFL_WAIT > DECFSZ int_delay1,F > GOTO OLOOP > RETURN > > T0_OVFL_WAIT > BTFSS INTCON, T0IF > GOTO T0_OVFL_WAIT > BCF INTCON,T0IF > RETURN > > Joe > -- > 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 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .