Hello, I just wanted to thank you Jinx and all of you that helped me out with your suggestions. I got it to work, below is the "new code". Best Regards, Nick LIST P=PIC16F628A, R=HEX, C=120, N=50 include "P16f628A.inc" __FUSES _CP_OFF&_HS_OSC&_WDT_OFF&_LVP_OFF&_MCLRE_OFF ;------------------------------------------------------------------- ; Variables allocation ;------------------------------------------------------------------- CBLOCK H'7A' LEDS ; Holder for Portb LED rotation DELAY_REG1 DELAY_REG2 ENDC CBLOCK H'70' TMP_W ; Holder for W TMP_STATUS ; Holder for Status ENDC ;------------------------------------------------------------------- ; Start of porgram pointer ;------------------------------------------------------------------- ORG H'0000' ; Start VECTOR BANKSEL 0 GOTO MAIN ; upon power up reset ;------------------------------------------------------------------- ; Interrupt vector ;------------------------------------------------------------------ ORG H'0004' ; Interrupt service routine MOVWF TMP_W ; Copy W to a temporary register SWAPF STATUS,W ; Swap Status Nibbles and move to W (preserves Status) MOVWF TMP_STATUS ; Copy STATUS to a temporary register CLRC RLF LEDS,F BTFSC STATUS,C ; Wrap around BSF LEDS,0 MOVFW LEDS MOVWF PORTB ; BCF PORTA,0 ; Test LED on porta bit 0 SWAPF TMP_STATUS,W ; Pull Status back into W MOVWF STATUS ; Store it in status (would change Z but overwrites it) SWAPF TMP_W,F ; Prepare W to be restored SWAPF TMP_W,W ; Return it without changing Z bit in STATUS BCF INTCON,2 ; clear interrupt flag RETFIE ;----------------------------------------------------------------------- ; Initializations ;----------------------------------------------------------------------- MAIN: CLRF PORTA MOVLW B'00000111' ; Turn off comparators on PORTA MOVWF CMCON BSF STATUS,RP0 ; Select Bank 1 MOVLW b'00000000' ; MOVWF TRISB ; Configure PORTB, output MOVLW b'00011110' ; RA<0:4> as inputs MOVWF TRISA ; Configure PORTA MOVLW b'01010000' ; Timer0 in timer mode, prescaler=1:2 assigned to timer0 MOVWF OPTION_REG ; Configure options BCF STATUS,RP0 ; Return to Bank 0 CLRF PORTB ; Initialize PORTB output CLRF PORTA ; Initialize PORTA outputs MOVLW b'10100000' ; Interrupt TMR0 overflow MOVWF INTCON ; Configure and activate interrupts CLRF DELAY_REG1 CLRF DELAY_REG2 MOVLW b'10000000' ; Load with low duty cycle on reset MOVWF LEDS ; Variable written to PORTB ;----------------------------------------------------------------------- ; polling section ;----------------------------------------------------------------------- WAIT: BTFSC PORTA,1 GOTO WAIT MOVLW b'00001111' MOVWF LEDS CALL DELAY ; BSF PORTA,0 ;Test LED on PORTA bit 0 WAIT2: BTFSC PORTA,1 GOTO WAIT2 MOVLW b'00000001' MOVWF LEDS CALL DELAY GOTO WAIT DELAY: DECFSZ DELAY_REG1 GOTO DELAY DECFSZ DELAY_REG2 GOTO DELAY RETURN END __________________________________ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/ -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist