Hi Andre, > > I have got your example code thank you very much for > replay. I did not try it yet but this is what I tried and > it did not work. > > BTFSS PORTB,7 ; TEST SWITCH > MOVLW B'00000001' ; TIMER USES INTERNAL CLOCK > BTFSC PORTB,7 ; TEST SWITCH > MOVLW B'00100000' ; TIMER USES EXTERNAL CLOCK > MOVWF OPTION_REG > > I put this code right after setting bank1. > > when I try with out bit test each one separately works. > My question is why bit test doesn't work. > Before this I have > BSF STATUS,RP0 > MOVLW B'11110000' > MOVWF TRISB I think the problem is that you must set to bank 0 first when bit-testing PORTB because bank 1 holds the TRIS registers. My previous code also had the flaw. I should have been: BCF STATUS,RP0 ;set to bank 0 SWAPF PORTB,W ;swap nibbles ADDLW B'00011000' ;reverse timer bit and shift left by 1 ANDLW B'00010111' ;mask needed bits BSF STATUS,RP0 ;set to bank 1 MOVWF OPTION_REG ;put in OPTION I hope this helps. Reggie