Somasundaram wrote: > > Sorry, I didn't put it clear. > > test_for_bit equ 0x27 > value_to_test equ 0x26 > > Say value 5 is stored in the file register 0x27 > I would like to test the bit of . > > BTFSS value_to_test,[value stored in test_for_bit] -> Test the bit5 in the > value stored at 0x26 Try this: MOVF TEST_FOR_BIT,W MOVWF TEMP1 MOVF VALUE_TO_TEST,W MOVWF TEMP2 ;ABOVE ONLY NEEDED IF YOU WANT TO RETAIN ORIGINAL VALUES MOVF TEMP1,F BTFSC STATUS,Z GOTO TEST2 ;IF TEMP1 =0, CHECK ONLY LSB TEST BCF STATUS,C RRF TEMP2,F DECFSZ TEMP1,F GOTO TEST TEST2 BTFSS TEMP2,0 GOTO IF_0 GOTO IF_1 > Something like: I would like to count the number of 1's in the value ( at > 0x26) using btfss instruction. I take it this is part of your first question so change above to: MOVF TEST_FOR_BIT,W MOVWF TEMP1 MOVF VALUE_TO_TEST,W MOVWF TEMP2 CLRF TEMP3 ;ABOVE ONLY NEEDED IF YOU WANT TO RETAIN ORIGINAL VALUES INCF TEMP1,F ;EXTRA COUNT TO CHECK LSB TEST BTFSC TEMP2,0 INCF TEMP3,F ;CONTAINS NUMBER OF "1" BITS BCF STATUS,C RRF TEMP2,F DECFSZ TEMP1,F GOTO TEST GOTO NEXT..... This clear for you? I did not take any "short cuts" here so that you can see what can be done. Quentin