Andreas Nyholm wrote: > ; Wait for doors closed AND doors locked. > WAIT2 MOVF PORTA, W ; get port A into W > ANDLW b'00000100' ; check RA0(doors closed), RA1(doors > locked) and RA2(ignition off) > BTFSC STATUS,Z ; skip when result is zero > GOTO WAIT2 > As you see am I taking porta into W, and it is supposed to go forward > in my program only if porta is 00000100 but that isn't the truth... > It's always continuing with the program and never goes back to WAIT2. That indicates that RA2 is always set, since that is the only bit your mask is looking for. Methinks the code you *want* is: WAIT2 MOVF PORTA, W ; get port A into W ANDLW b'00000111 ; Test RA0, RA1, RA2 XORLW b'00000100' ; RA0 = 0, RA1 = 0, RA2 = 1 SKPZ ; skip when match (BTFSS STATUS, Z) GOTO WAIT2 -- Cheers, Paul B.