Joseph90,ahí le dejo el código en assembly, el .hex y la distribución de pines
LIST P=16F84A
#include <p16F84A.inc>
;ESTE CODIGO ENCIENDE Y APAGA DIFERENTES LEDS,ELABORADO POR HENRY MOLINA
;PARA JOSEPH90
org 0x00
status equ 03h
cblock 0ch
PDel0,PDel1,PDel2,PDel0a,PDel1a,PDel2a,PDel3a
endc
bsf status,5
clrf TRISB
movlw b'00001' ;bit0 como entrada
movwf TRISA
bcf status,5
clrf PORTB
clrf PORTA
;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
inicio btfss PORTA,0 ;verifica si el witch está presionado
goto inicio ;si no vuelve a escanear el switch
bsf PORTB,0 ;enciende el primer led
call segundo
call segundo ;espera 2 segundos
bsf PORTB,1 ;enciende el segundo led
call segundo
bcf PORTB,1 ;apaga el segundo led
pasodos btfss PORTA,0 ;verifica si el witch está presionado
goto pasodos ;si no vuelve a escanear el switch
bcf PORTB,0 ;apaga el primer led
bsf PORTB,2 ;enciende el tercer led
call segundo
call segundo ;espera 2 segundos
bsf PORTB,3 ;enciende el cuarto led
call segundo
bcf PORTB,3 ;apaga el cuarto led
pasotres btfss PORTA,0 ;verifica si el witch está presionado
goto pasotres ;si no vuelve a escanear el switch
bcf PORTB,2 ;apaga el tercer led
bsf PORTB,4 ;enciende el quinto led
call segundo
call segundo ;espera 2 segundos
bsf PORTB,5 ;enciende el sexto led
call segundo
bcf PORTB,5 ;apaga el quinto led
ultimo btfss PORTA,0 ;verifica si el witch está presionado
goto ultimo ;si no vuelve a escanear el switch
bcf PORTB,4
goto inicio ;comienza de nuevo
;------------------------------------------------------------------------------
segundo
movlw .14 ; 1 set number of repetitions (C)
movwf PDel0 ; 1 |
PLoop0 movlw .72 ; 1 set number of repetitions (B)
movwf PDel1 ; 1 |
PLoop1 movlw .247 ; 1 set number of repetitions (A)
movwf PDel2 ; 1 |
PLoop2 clrwdt ; 1 clear watchdog
decfsz PDel2, 1 ; 1 + (1) is the time over? (A)
goto PLoop2 ; 2 no, loop
decfsz PDel1, 1 ; 1 + (1) is the time over? (B)
goto PLoop1 ; 2 no, loop
decfsz PDel0, 1 ; 1 + (1) is the time over? (C)
goto PLoop0 ; 2 no, loop
PDelL1 goto PDelL2 ; 2 cycles delay
PDelL2 clrwdt ; 1 cycle delay
return ; 2+2 Done
end