Uso de tablas y retardos

5
10/06/2015 ESCUELA SUPERIOR POLITÉCNICA DEL LITORAL TAREA 9: Uso de tablas y retardos INTEGRANTES: Gabriel Andrade Niel Mayor Fuentes Escarleth Rueda

Transcript of Uso de tablas y retardos

Page 1: Uso de tablas y retardos

10/06/2015ESCUELA SUPERIOR POLITÉCNICA DEL LITORAL

TAREA 9: Uso de tablas y retardos

INTEGRANTES: Gabriel Andrade Niel Mayor Fuentes Escarleth Rueda

Page 2: Uso de tablas y retardos

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

Page 3: Uso de tablas y retardos

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;

************************************************************************

Page 4: Uso de tablas y retardos

TAREA DE MICROCONTROLADORES #9

FUNCIONAMIENTO EN PROTEUS

PRIMERA LETRA

SEGUNDA LETRA

Page 5: Uso de tablas y retardos

TAREA DE MICROCONTROLADORES #9

TERCERA LETRA