Electronics Master wrote: > WHAT IS WRONG ????????? Caps for code please, not conversation. > PIC 16F84 TO CHECK (OPEN-CLOSE) PORT B,1 > AND IF PORT B,1 IS SET = 1 > THEN MAKE PORT B,4 SET = 1 > LIST P=16F84 > PORTB EQU 06H ; You should be using something like: ;---------------------------------- LIST P=16F84 ; suppress nuisance warnings: errorlevel -224 errorlevel -305 ; Include standard defines INCLUDE "\pic\mpasm\p16F84.inc" > START ; This is a *label*. Must be in first column. > TRIS PORTB ; You haven't given it a value in W to use to set the TRIS register. ; I think you want to MOVLW 0x02 just before this to set PORTB,1 as the ; only input. Do *not* connect unused pins to a supply rail. ; You only need to set the TRIS register once anyway, so the loop point ; can occur after this. With due respect to Andre, forget bank ; switching! > BTFSS PORTB,1 > GOTO START ; So, if PORTB,1 is zero, there is no way to zero PORTB,4? > BSF PORTB,4 > GOTO START > ORG 3FFF > END ; You don't need to ORG an END statement. > WHAT IS WRONG ????????? Everything! Try: ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LIST P=16F84 ; suppress nuisance warnings (should be in include file actually): errorlevel -224 errorlevel -305 ; Include standard defines - actual path depends on your installation: INCLUDE "\pic\mpasm\p16F84.inc" ORG 0 GOTO START ; Jump over interrupt vector. ORG 0x10 START MOVLW 0 ; All outputs in TRIS PORTA ; port A unless otherwise used. MOVLW 0x02 ; Bit 1 is input, all others outputs TRIS PORTB ; in port B CLR PORTA ; Start with CLR PORTB ; a clean slate LOOP1 BTFSC PORTB,1 ; If input set, BSF PORTB,4 ; set output BTFSS PORTB,1 ; If input clear, BCF PORTB,4 ; clear output CLRWDT ; Just in case you had it enabled GOTO LOOP1 ; loop forever .... END ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ No warranty applies to this code. -- Cheers, Paul B.