0% found this document useful (0 votes)
40 views2 pages

Tarea 10: Nelson Carreño

The document describes a program for a PIC16F887 microcontroller. It defines variables in memory, sets ports as outputs, clears variables, writes data from EEPROM to a port and includes a delay loop. The program reads successive addresses from EEPROM and outputs the data to a port.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views2 pages

Tarea 10: Nelson Carreño

The document describes a program for a PIC16F887 microcontroller. It defines variables in memory, sets ports as outputs, clears variables, writes data from EEPROM to a port and includes a delay loop. The program reads successive addresses from EEPROM and outputs the data to a port.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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