On Wed, 9 May 2007 12:31:34 -0700, "Marcel Birthelmer" wrote: >Hi all, >I have a question regarding to consecutive btfsX statements. >For example: > >btfss REG, 0 >btfss REG, 1 >bsf REG, 2 > >now obviously when REG,0 is 0 then REG,1 is evaluated as expected, but >what happens if REG,0 is 1? Is bsf REG,2 executed, or is it evaluated >as a NOP? > >The processor is an 18F452, though I'm not sure that's relevant. I >checked the description for BTFSS, and it says that if it's a "skip" >followed by a 2-word instruction, it is followed by 2 NOPs. But does a >conditional followed by a 1-word instruction become a 2-word >instruction? I think not, but I'm not sure. > In the 18F chips, the second word of all two-word instructions is always executed by itself as a 'nop'. If it weren't, using the 'btfsc' and 'btfss' instructions would be so unpredictable as to be useless. That doesn't really matter since that second btfss instruction is a one-word instruction anyway. If bit 0 of REG is set, the "btfss REG, 0" instruction will skip the following instruction, the "btfss REG, 1", and execute the 'bsf' instruction. Regards, Bob -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist