Searching \ for '(Fwd) 16c84 EEPROM - Pedro Barrios' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/microchip/memory.htm?key=eeprom
Search entire site for: '16c84 EEPROM - Pedro Barrios'.

Truncated match.
PICList Thread
'(Fwd) 16c84 EEPROM - Pedro Barrios'
1997\02\20@165430 by John Sanderson

flavicon
face
------- Forwarded Message Follows -------
From:          Self <Single-user mode>
To:            spam_OUTpiclistTakeThisOuTspammitvma.mit.edu
Subject:       16c84 EEPROM - Pedro Barrios
Date:          Thu, 20 Feb 1997 10:43:01

Hi Pedro & all other PIC.ers,
Writing to the EEprom memory space is documented in the c84
data sheet. A bit cryptically / incompletely, I thought.
..
To prevent inadvertant writes to this area except by someone
who SERIOUSLY wants to do so, they don't make it too easy.
I got some good help from other PIC.ers about this recently
-- have succeeded & can pass the results to you.
..
Here is the coded routinery I ended up with:-
(sorry if the indents are scrappy)
..
;SUBROUTINES

;The following `eprom write' routine requires that eeadr @ loc 0x009
;contains the address of the eeprom data byte to be loaded.
;The data must be pre-loaded in eedata @ loc 0x008
;In addition, the  eecon1,wren   bit must be set before calling this routine
eprmwr                          ;write byte to eeprom loc.
       bcf     intcon,gie      ;make sure ints disabled, work on bank1
       bsf     status,rp0      ;set to bank 1,see c84 para 7.2
       movlw   0x055           ;fairy-godmother value, given by uchip
       movwf   eecon2
       movlw   0x0AA           ;another fairy-godmother value
       movwf   eecon2
       bsf     eecon1,eewr     ;set write control bit & begin write
ee1     btfsc   eecon1,eewr     ;poll int flag bit until it is set hi
       goto    ee1             ;write until job done
       bcf     eecon1,eeif     ;must clear this bit, don't kno why??
       bcf     status,rp0      ;bank 0
       bsf     intcon,gie      ;re-enable interrupts
       return

;following routine requires eeadr to be pre-loaded with the eeprom location
;--like a pointer. The contents of the location are returned in eedata reg.

eprmrd                          ;read byte value from eeprom ->w reg
       bsf     status,rp0      ;bank 1
       bsf     eecon1,eerd     ;ee read
       bcf     status,rp0      ;bank 0
       return


email from John Sanderson   /   JS Controls, Boksburg, RSA
Manufacturer & purveyor of laboratory force testing apparatus
and related products and services.
Tel/fax: Johannesburg 893 4154    Cellphone 082 453 4815

More... (looser matching)
- Last day of these posts
- In 1997 , 1998 only
- Today
- New search...