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 But the value stored in 0x27 will keep changing with program execution. Say, after sometime( may be while in a loop), 0x27 holds the value 3, then the same statement must test the bit3 of the value stored at 0x26. Something like: I would like to count the number of 1's in the value ( at 0x26) using btfss instruction. - Somasundaram. At 02:09 PM 10/16/99 +0200, you wrote: >I don't understand your question. What is it you want to test in the >register? Do you want to test the position of the bit and then do >instructions based on its position in the register? >Or do you want to do instuctions based on the value in the register? > >You ask if there are other instructions based on a bit. Depends what you >want to do. >Other ways of testing for bits set is the MOVLW K (constant) and SUBWF >0x027,W routine >Then you test Status for Z, C or DC (BTFSS STATUS,Z) as one example. >There are many more. > >Better if you explain to us what you need to do. Maybe with some short >code examples. > >Quentin > >Somasundaram wrote: >> >> Hi, >> >> I am a PIC newbie. I am working on 16f877. I use MPLAB 4.12 for Windows. >> >> I have a value stored in the FileRegister 0x27 < General Purpose Register >> >. That value is always between 0 and 7 (both inclusive). This value will >> be dynamically varying during program execution. I need to use this value >> in the instruction BTFSS. How do I use it as required? Are there any other >> methods that can be used to skip instructions based on a bit, with the bit >> position dynamically varying during program execution? >> >> Regards, >> Somasundaram. > >