uso de tablas y retardos
Post on 11-Aug-2015
131 Views
Preview:
TRANSCRIPT
10/06/2015ESCUELA SUPERIOR POLITÉCNICA DEL LITORAL
TAREA 9: Uso de tablas y retardos
INTEGRANTES: Gabriel Andrade Niel Mayor Fuentes Escarleth Rueda
TAREA DE MICROCONTROLADORES #9
CODIGO
;*********************************************************************
LIST p=16F887 ;Tipo de microcontrolador
INCLUDE P16F887.INC ;Define los SFRs y bits del
;P16F887
__CONFIG _CONFIG1, _CP_OFF&_WDT_OFF&_XT_OSC
;Setea parámetros de
;configuración
errorlevel -302 ;Deshabilita mensajes de
;advertencia por cambio
;bancos
;INICIO DEL PROGRAMA
org 0x00 ; Address of the first program instruction
;DECLARACION DE VARIABLES
cblock 0x20
counter1
counter2
endc
;SETEO DE PUERTOS
banksel TRISB ; Selects bank containing register TRISB
clrf TRISB ; All port B pins are configured as outputs
banksel ANSEL
clrf ANSEL
clrf ANSELH
banksel PORTB ; Selects bank containing register PORTB
;INICIALIZACION DE VARIABLES
clrf PORTB
;DESARROLLO DEL PROGRAMA
LOOP
movlw 0
call TABLA
movwf PORTB
TAREA DE MICROCONTROLADORES #9
call RETARDO
movlw 1
call TABLA
movwf PORTB
call RETARDO
movlw 2
call TABLA
movwf PORTB
call RETARDO
;**********************IMPLEMWENTACIÓN DE LA TABLA***********************
TABLA
addwf PCL,1
retlw H'7D'
retlw H'79'
retlw H'71'
;**********************IMPLEMWENTACIÓN DEL RETARDO (Delay)***********************
RETARDO
clrf counter2 ; Clears variable "counter2"
loop1
clrf counter1 ; Clears variable "counter1"
loop2
decfsz counter1 ; Decrements variable "counter1" by 1
goto loop2 ; Result is not 0. Go to label loop2
decfsz counter2 ; Decrements variable "counter2" by 1
goto loop1 ; Result is not 0. Go to lab loop1
return ; Return from subroutine "DELAY"
goto LOOP
end ; End of program;
************************************************************************
TAREA DE MICROCONTROLADORES #9
FUNCIONAMIENTO EN PROTEUS
PRIMERA LETRA
SEGUNDA LETRA
TAREA DE MICROCONTROLADORES #9
TERCERA LETRA
top related