Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Tarea 10: Nelson Carreño

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Tarea 10

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 parmetros de
;configuracin

errorlevel -302

cblock 0x20 ; Block of variables starts at address 20h


ADDRESS
counter1
counter2 ; Variable "counter" at address 20h
endc
;************************************************************************
;INICIO DEL PROGRAMA
Org 0x00 ; vector de reset
Goto main ; salto a label "main"

main
;SETEO DE PUERTOS
banksel ANSEL
clrf ANSEL
clrf ANSELH
banksel TRISB
clrf TRISB
clrf PORTB
clrf ADDRESS
clrf counter1
clrf counter2
movlw 0x55 ;DIRECCION 251 DE EEPROM
movwf ADDRESS
loop
bsf STATUS,RP1 ;
bcf STATUS,RP0 ; Acceder al banco 2
movf ADDRESS,W ; Mover la direccin al registro W
movwf EEADR ; Escribir la direccin
bsf STATUS,RP0 ; Acceder al banco 3
bcf EECON1,EEPGD ; Seleccionar la EEPROM
bsf EECON1,RD ; Leer los datos
bcf STATUS,RP0 ; Acceder al banco 2

Nelson Carreo
movf EEDATA,W ; Dato se almacena en el registro W
banksel PORTB
movwf PORTB
call DELAY
incfsz ADDRESS,F
goto loop

DELAY
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

End ; End of program

Nelson Carreo

You might also like