Sie sind auf Seite 1von 1

;-----------------------------------------------------------------

;
; Practica 01: Encender un Diodo LED con retardo de 100ms
; Integrantes: Pedro Suarez, Hugo Rodriguez, Elias Chacon
;
;-----------------------------------------------------------------
;------------ CONFIGURACION DEL ENSAMBLADOR ----------------------
LIST P=18F4550
#include <p18f4550.inc>
;------------ VARIABLES ------------------------------------------
n1 EQU 0c
n2 EQU od
ORG 0
;------------ CONFIGURACION DE PUERTOS ---------------------------
bsf STATUS,5 ;Se ubica en el banco 1 de registros
movlw .1 ;Se carga el valor 01 en el acumulador (w)
movwf TRISA ;Se configura el pin 0 del puerto A como entrada
(1)
;y el pin 1 del mismo puerto como salida (0)
bcf STATUS,5 ;Se ubica en el banco 0 de registros
bcf PORTA,1 ;Se pone a 0 el pin 1 del puerto A (se limpia)
;------------ PROGRAMA PRINCIPAL ---------------------------------
Inicio
btfsc PORTA,0 ;Se pregunta si el boton esta pulsado (RA0=1)
;de ser asi, se salta la siguiente instruccion
goto Inicio ;Vuelve al inicio
call Retardo ;Se llama a la subrutina de retardo
bsf PORTA,1 ;Se enciende
;------------ SUBRUTINAS -----------------------------------------
Retardo
;99998 cycles
movlw 0x1F
movwf n1
movlw 0x4F
movwf n2
Retardo_0
decfsz n1, f
goto $+2
decfsz n2, f
goto Retardo_0
;2 cycles
goto $+1
return
END

Das könnte Ihnen auch gefallen