You are on page 1of 2

;***************************************************************************

;* INSTITUTO TECNOLOGICO DE OAXACA *


;* INGENIERIA ELECTRONICA *
;* MICROCONTROLADORES *
;* PRACTICA No. 2 *
;* secuencias de leds *
;***************************************************************************
__CONFIG CONFIG1, _LVPOFF & _FCMENOFF & _IESOOFF & _BORENOFF & _CPDOFF & _CPOFF
& _MCLREOFF & _PWRTEON & _WDTEOFF & _FOSCINTRC_NOCLKOUT
__CONFIG CONFIG2, _WRTOFF;

LIST P=16F887
INCLUDE "P16F887.INC"

CBLOCK 0x21
reg1,reg2,reg3
ENDC

ORG 0X00
inicio bsf STATUS,RP0

movlw 0x0F
movwf TRISA
clrf TRISB
bsf STATUS,RP1

movlw 0x0F
movwf ANSEL
bsf STATUS,RP0
bsf STATUS,RP1

menu btfss PORTA,2


goto menu
btfsc PORTA,0
goto pruebaRA1
btfsc PORTA,1
call secuencia_2
call secuencia_0
pruebaRA1 btfsc PORTA,1
call secuencia_3
call secuencia_1

secuencia_0 clrf PORTB


bsf STATUS,C
corre rlf PORTB,1
call retardo
btfss PORTB,7
goto corre
btfss PORTA,3
goto secuencia_0
clrf PORTB
goto menu
secuencia_1 clrf PORTB
bsf STATUS,C
corre rlf PORTB,1
call retardo
btfss PORTB,1
goto corre
btfss PORTA,3
goto secuencia_1
clrf PORTB
goto menu

secuencia_2 clrf PORTB


bsf STATUS,C
led rlf PORTB,1
call retardo
btfss PORTB,7
goto led
led2 rlf PORTB,1
call retardo
btfss PORTB,1
goto led 2
btfss PORTA,3
goto secuencia_2
clrf PORTB
goto menu

secuencia_3 clrf PORTB


bsf STATUS,C
led1 rlf PORTB,1
call retardo
btfss PORTB,7
goto led 1
led3 rlf PORTB,1
call retardo
btfss PORTB,1
goto led3
btfss PORTA,3
goto secuencia_3
clrf PORTB
goto menu

retardo movlw .50


movwf reg1
t3 movlw .60
movwf reg2
t2 movlw .60
movwf reg3
t1 decfsz reg3, 1
goto t1
decfsz reg2,1
goto t2
decfsz reg1,1
goto t3
return

end

You might also like