Está en la página 1de 3

I

PRACTICA 1
Recorridos de leds con interrupcin de cinco segundos.
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC
INCLUDE P16F84A.INC
PDel0 equ
0C
PDel1 equ
0D
CONT equ 0Ch
CONT2 equ 0Dh
CONT3 equ 0Eh
CONT4 equ 0Fh
ORG 0
BSF
STATUS,5
; activa la pgina 1
MOVLW B'00000' ; carga 00000 en W
MOVLW B'00000000'
; carga 00000000 en W
MOVWF TRISB ; puerto b todo salido
BCF
STATUS,5
; volvemos a la pgina 0
MOVLW B'00000000'
; ponemos a cero el
MOVWF PORTB ; el puerto b
INICIO
BSF
CALL
BCF
BSF
CALL
BCF

; etiqueta
PORTB,0 ; prendemos y apagamos
DEMORA
; llamada a tiempo de 0.5s
PORTB,0 ; despus trataremos d usar otra funcin
PORTB,1
DEMORA
PORTB,1

BSF
CALL
BCF

PORTB,2
DEMORA
PORTB,2

BSF
CALL
BCF

PORTB,3
DEMORA
PORTB,3

BSF
CALL
BCF

PORTB,4
DEMORA
PORTB,4

BSF
CALL
BCF

PORTB,5
DEMORA
PORTB,5

BSF
CALL
BCF

PORTB,6
DEMORA
PORTB,6

BSF

PORTB,7

CALL
BCF

DEMORA
PORTB,7

BSF
CALL
BCF

PORTB,6
DEMORA
PORTB,6

BSF
CALL
BCF

PORTB,5
DEMORA
PORTB,5

BSF
CALL
BCF

PORTB,4
DEMORA
PORTB,4

BSF
CALL
BCF

PORTB,3
DEMORA
PORTB,3

BSF
CALL
BCF

PORTB,2
DEMORA
PORTB,2

BSF
CALL
BCF

PORTB,1
DEMORA
PORTB,1

GOTO INICIO
DEMORA
movlw 0ABH
movwf CONT3
CICLO6 movlw 00DH
movwf CONT2
CICLO5 movlw 0ABH
movwf CONT
CICLO4 decfsz CONT,1
goto CICLO4
decfsz CONT2,1
goto CICLO5
decfsz CONT3,1
goto CICLO6
Return
END

Imagen 3. Funcionamiento de recorrido de leds con cinco segundos.

También podría gustarte