Hi Leonardo. Couple of academical examples more... WBR Dmitry. > portb equ 0x06 > ; > org 0 > ; > movlw b'111101111' > tris portb ;portb set to inputs except for port 4 Loop: rlf PORTB,W ;read from PORTB and shift it to W movwf PORTB ;pit it back to PORTB goto Loop ;... Loop: movlw 0 ;if PORTB.3=0 load W.4=0 btfsc PORTB,3 movlw 0x10 ;if PORTB.3=1 load W.4=1 movwf PORTB goto Loop ;... > loop btfss portb,3 ; bit 3 high? > bcf portb,4 ; if not, clear port b,4 > btfsc portb,3 ; bit 3 low? > bsf portb,4 ; if not, set port b,4 > goto loop