You are on page 1of 2

__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC

LIST P=16F84A
INCLUDE<P16F84A.INC>
ORG 0
CBLOCK 0x0C
ContadorA
ContadorB
ENDC
Start
clrf PORTB
bsf STATUS,RP0
clrf TRISB
movlw b'00011111'
movwf TRISA
bcf STATUS,RP0
movlw b'00001111'
movwf PORTB
Main
call Delay_200
call Delay_200
call Delay_100
btfsc PORTA,RA0
goto Presionado
call Delay_100
call Delay_200
call Delay_200
btfsc PORTA,RA0
goto Presionado
swapf PORTB
goto Main
Suelto
call Delay_200
call Delay_100
movlw b'00001111'
movwf PORTB
goto Main
Presionado
movlw b'00000001'
movwf PORTB
Presionado2
call Delay_200
call Delay_100
rlf PORTB,1
btfss PORTA,RA0
goto Suelto
goto Presionado2
Delay_200
movlw d'200'
goto Delay
Delay_100
movlw d'100'
goto Delay
Delay
movwf ContadorB
Loop1
movlw d'249'
movwf ContadorA
Loop2
nop
decfsz ContadorA,F
goto Loop2
decfsz ContadorB,F
goto Loop1
return
END

You might also like