Searching \ for '16C84 EEPROM writing' 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 writing'.

Truncated match.
PICList Thread
'16C84 EEPROM writing'
1997\03\24@005724 by David BALDWIN

flavicon
face
Hi,


       I had like to write and read from the EEPROM of the 16C84. I tried to
write at 0x00, and it worked. I tried to do another write, next the
first one, setting the WREN bit and then the WR bit, after modifying the
EEADR and EEDATA files. I only got something writed on the second
location! I took my first code back and decided to make a loop,
incrementing the EEADR register and doing each time the whole thing:

       clrf temp
loop    set WREN bit
       write 55h to EECON2
       write AAh to EECON2
       set WR bit
       move temp --> EEADR
       set WR bit
       btfss temp,6
       goto loop


       The only location that has been writed is location 63! Can anybody help
me? Or is there any code I can get to make this work? Thanks in advance.

-david

1997\03\24@012133 by TONY NIXON 54964

flavicon
picon face
This is what I use to store EEPROM data.
If writes are done more than approx. 10mS apart then
the 'wtloop' can be deleted.

      bsf status,rp0  ; ram page 1
       bcf eecon1,4    ; clear write completion bit
       bsf eecon1,2    ; set WREN bit = 1
       nop
       movlw 55h       ; eeprom write
       movwf eecon2
       movlw 0xaa
       movwf eecon2
       bsf eecon1,1    ; set WR bit to initiate write
       ;
wtloop  btfss eecon1,4  ; wait until write is finished (~10mS)
       goto wtloop
       ;
       bcf eecon1,2    ; clear WREN bit
       bcf status,rp0  ; ram page 0
       incf eeadr      ; set for next eeprom address


Regards
Tony


Just when I thought I knew it all,
I learned that I didn't.

1997\03\24@012333 by Andrew Warren

face
flavicon
face
David BALDWIN <spam_OUTPICLISTTakeThisOuTspamMITVMA.MIT.EDU> wrote:

>         clrf temp
> loop    set WREN bit
>         write 55h to EECON2
>         write AAh to EECON2
>         set WR bit
>         move temp --> EEADR
>         set WR bit
>         btfss temp,6
>         goto loop

David:

The proper sequence is:

       clear TEMP

   LOOP:

       copy TEMP to EEADR
       (optionally load EEDATA with something here)

       set WREN
       write 55 to EECON2
       write AA to EECON2
       set WR

       wait for WR to clear

       increment TEMP
       btfss TEMP,6
       goto LOOP

Your code only wrote to address 63 because you failed to wait for
the WR bit to clear (which signals the end of the internal write
cycle).

-Andy

=== Andrew Warren - .....fastfwdKILLspamspam@spam@ix.netcom.com
=== Fast Forward Engineering - Vista, California
===
=== Did the information in this post help you?  Consider
=== contributing to the PICLIST Fund.  Details are at:
=== www.geocities.com/SiliconValley/2499/fund.html

1997\03\24@013410 by Andrew Warren

face
flavicon
face
   Whoops... I left out a line.

   I wrote:

{Quote hidden}

   There should be a "clear WREN" just before the "increment TEMP".

   -Andy

=== Andrew Warren - fastfwdspamKILLspamix.netcom.com
=== Fast Forward Engineering - Vista, California
===
=== Did the information in this post help you?  Consider
=== contributing to the PICLIST Fund.  Details are at:
=== www.geocities.com/SiliconValley/2499/fund.html

1997\03\24@014242 by David BALDWIN

flavicon
face
Thanks to you, Tony and Andrew. If I understand, I have to write 55h
and AAh each time I am writing a byte! That's boring... Andrew, why do
you want me to do clear WREN?

-david

1997\03\24@025959 by Andrew Warren

face
flavicon
face
David BALDWIN <.....PICLISTKILLspamspam.....MITVMA.MIT.EDU> wrote:

> Thanks to you, Tony and Andrew. If I understand, I have to write 55h
> and AAh each time I am writing a byte!

   David:

   Yes, that's correct... It's also a good idea to make sure that
   interrupts are disabled during the "write 55/write AA" section.

> Andrew, why do you want me to do clear WREN?

   It's not strictly necessary, but it's a good idea... While WREN
   is clear, accidental writes to the EEPROM can't occur.

   If you like, you can move the "clear WREN" to a point AFTER the
   loop, rather than leaving it inside the loop as I showed.  I'd
   probably leave it inside the loop, though, since the
   10-millisecond EEPROM write time obviates the need to save
   instruction cycles within the loop.

   -Andy

=== Andrew Warren - EraseMEfastfwdspam_OUTspamTakeThisOuTix.netcom.com
=== Fast Forward Engineering - Vista, California
===
=== Custodian of the PICLIST Fund -- For more info, see:
=== www.geocities.com/SiliconValley/2499/fund.html

1997\03\24@141700 by )

flavicon
face
If I read your message correctly, it looks as if you made the same
mistake I did when I first started using the '84s EEPROM. EEADR gets
modified every time you do a write (it works OK to increment it on read
though). All you need to do is increment a register and copy it to EEADR
before you do a write.


Frank Richterkessing
Experimental Methods Engineer
GE Appliances

FRANK.RICHTERKESSINGspamspam_OUTAPPL.GE.COM



{Quote hidden}

1997\03\24@162456 by Andrew Warren

face
flavicon
face
Richterkessing, Frank H (GEA, 055132) <RemoveMEPICLISTTakeThisOuTspamMITVMA.MIT.EDU> wrote:

> EEADR gets modified every time you do a write

   No, it doesn't.

   -Andy

=== Andrew Warren - spamBeGonefastfwdspamBeGonespamix.netcom.com
=== Fast Forward Engineering - Vista, California
===
=== Custodian of the PICLIST Fund -- For more info, see:
=== www.geocities.com/SiliconValley/2499/fund.html

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