Searching \ for '[PIC]: 16F628 EEPROM revisited' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/memory.htm?key=eeprom
Search entire site for: '16F628 EEPROM revisited'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: 16F628 EEPROM revisited'
2002\02\22@122434 by tcrist

flavicon
face
I've looked at the errata page and set my read/write/verify routines as
shown.  I'm running an 'LF627 at 4Mhz at 3.0Volts and having trouble reading
EE values at full speed.  If I step through the code on my ICE2000
everything works fine.  If I run at full speed, when I read two values they
come back equal to the first.  In other words:

EEADR 0x00 = AA
EEADR 0x01 = 55

If I read EEADR 0x00 and store it in a register it equals AA.  Then if I
read EEADR 0x01 and store it in a register it also equals AA.  If I step
through the program, EEADR 0x01 = 55.  Just to test it, I put a 10uS delay
between reads - no change.  Then I tried to read EEADR 0x00 then 0x04 - no
change.

Any thoughts would be greatly appreciated.

Thanks,

Tim Crist

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\02\22@132501 by Barry Gershenfeld

picon face
You didn't say how you are able to see the two values when you just run it.  I
can't tell you how many times I've had the actual device working but messed
up on my "debug" routine!

Barry

{Quote hidden}

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\02\23@060700 by Olin Lathrop

face picon face
> If I read EEADR 0x00 and store it in a register it equals AA.  Then if I
> read EEADR 0x01 and store it in a register it also equals AA.  If I step
> through the program, EEADR 0x01 = 55.  Just to test it, I put a 10uS delay
> between reads - no change.  Then I tried to read EEADR 0x00 then 0x04 - no
> change.

EEADR is just a RAM location in terms of reading/writing from the firmware.
If you write AA to it, you will read AA from it.  However, if have no idea
what you mean by the phrase "read EEADR 0x01" verus "read EEADR 0x00.  EEADR
is at a fixed address specified by Microchip, and you can't control the
value you *read* from a register, so this makes absolutely no sense to me.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, spam_OUTolinTakeThisOuTspamembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\02\25@145453 by tcrist

flavicon
face
Okay,  I'll  try this again...

To read from my EEPROM inside the 'F628 I put the desired EE address in w
and call 'ReadEE' (see code snippet).

I'll confirm the value in address 0x00 of the EE space equal to 0xAA, and
address 0x01 equal to 0x55 by looking at the EEPROM memory window.  If I run
at 4Mhz and read the two addresses one after the other, 'ReadEE' sends back
0xAA each time.  If I step through the program using the ICE2000, I'll get
the correct values: 0xAA, and 0x55.  What gives?

ReadEE
       BANK1
               movwf   EEADR                   ;Address to read
               bsf     EECON1,RD               ;EE Read
               movf    EEDATA,w                ;w = EEDATA
       BANK0
               return


Thanks,

Tim


Date:    Fri, 22 Feb 2002 15:25:34 -0500
From:    Olin Lathrop <.....olin_piclistKILLspamspam@spam@EMBEDINC.COM>
Subject: Re: [PIC]: 16F628 EEPROM revisited

> If I read EEADR 0x00 and store it in a register it equals AA.  Then if I
> read EEADR 0x01 and store it in a register it also equals AA.  If I step
> through the program, EEADR 0x01 = 55.  Just to test it, I put a 10uS delay
> between reads - no change.  Then I tried to read EEADR 0x00 then 0x04 - no
> change.

EEADR is just a RAM location in terms of reading/writing from the firmware.
If you write AA to it, you will read AA from it.  However, if have no idea
what you mean by the phrase "read EEADR 0x01" verus "read EEADR 0x00.  EEADR
is at a fixed address specified by Microchip, and you can't control the
value you *read* from a register, so this makes absolutely no sense to me.

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestspamKILLspammitvma.mit.edu


2002\02\25@173326 by David Duffy

flavicon
face
Tim wrote:
>To read from my EEPROM inside the 'F628 I put the desired EE address in w
>and call 'ReadEE' (see code snippet).
>
>I'll confirm the value in address 0x00 of the EE space equal to 0xAA, and
>address 0x01 equal to 0x55 by looking at the EEPROM memory window.  If I run
>at 4Mhz and read the two addresses one after the other, 'ReadEE' sends back
>0xAA each time.  If I step through the program using the ICE2000, I'll get
>the correct values: 0xAA, and 0x55.  What gives?
>
>ReadEE
>         BANK1
>                 movwf   EEADR                   ;Address to read
>                 bsf     EECON1,RD               ;EE Read
>                 movf    EEDATA,w                ;w = EEDATA
>         BANK0
>                 return

Your EE read code is exactly what I use all the time.
How are you writing to the EE ? Via MPLAB or programmatically ?
Maybe the problem is in what happens just *after*  ReadEE.
Regards...

--
http://www.piclist.com hint: To leave the PICList
.....piclist-unsubscribe-requestKILLspamspam.....mitvma.mit.edu


2002\02\25@173756 by Olin Lathrop

face picon face
> To read from my EEPROM inside the 'F628 I put the desired EE address in w
> and call 'ReadEE' (see code snippet).
>
> I'll confirm the value in address 0x00 of the EE space equal to 0xAA, and
> address 0x01 equal to 0x55 by looking at the EEPROM memory window.  If I
run
> at 4Mhz and read the two addresses one after the other, 'ReadEE' sends
back
> 0xAA each time.

How do you know this if you're not stepping?  Betcha there is an assumption
in there somewhere you're not thinking about right now.

{Quote hidden}

I don't believe it.  The EEPROM read looks fine to me, and I don't believe
it is acting differently at high and low speed.  You'll find this a lot
quicker by assuming the PIC is working correctly and something is wrong with
your code.  Have you tried this on the real chip or just the emulator?


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, EraseMEolinspam_OUTspamTakeThisOuTembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestspamspam_OUTmitvma.mit.edu


2002\02\25@174951 by Bob Barr

flavicon
face
On Mon, 25 Feb 2002 12:51:58 -0700, Tim Crist wrote:

>Okay,  I'll  try this again...
>
>To read from my EEPROM inside the 'F628 I put the desired EE address in w
>and call 'ReadEE' (see code snippet).
>
>I'll confirm the value in address 0x00 of the EE space equal to 0xAA, and
>address 0x01 equal to 0x55 by looking at the EEPROM memory window.  If I run
>at 4Mhz and read the two addresses one after the other, 'ReadEE' sends back
>0xAA each time.  If I step through the program using the ICE2000, I'll get
>the correct values: 0xAA, and 0x55.  What gives?
>
>ReadEE
>        BANK1
>                movwf   EEADR                   ;Address to read
>                bsf     EECON1,RD               ;EE Read
>                movf    EEDATA,w                ;w = EEDATA
>        BANK0
>                return
>

I ran into something that might be similar in the 16C745's UART.

I wanted to send the same character 4 times as fast as I could. The
'745 runs at 24MHz. If I used the following sequence, some of the
bytes wouldn't transmit.

   movlw  'A'
   movwf  TXREG          ; write it
   btfss      PIR1, TXIF    ; TXREG empty?
   goto      $-1                 ; no, wait until it is
   movwf   TXREG         ; else write it again
   btfss      PIR1, RCIF
   goto      $-1
   movwf  TXREG
   btfss      PIR1, TXIF
   goto      $-1
   movwf  TXREG

I could never get all four bytes sent. Usually two or sometimes three
came across. I ended up having to insert a NOP between each "movwf
TXREG" instruction and the "btfss PIR1, TXIF" following it.
I suspect that there's a race condition between the PIR1 status bit
and the TXREG. Since you'd normally be changing w before writing TXREG
again anyway, you can burn that cycle by reloading w before you test
the PIR1 bit.

Placing a NOP between the bsf and the register read may cure your
problem. (Don't forget, the bsf does its write in the last Q cycle of
an instruction. Even at 4MHz, that's not much time before the read
occurs.)


Regards, Bob

--
http://www.piclist.com hint: To leave the PICList
@spam@piclist-unsubscribe-requestKILLspamspammitvma.mit.edu


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