[PIC]: PIC12F629/PIC12F675 EEPROM Write Coding

276 views
Skip to first unread message

Bob Axtell

unread,
Oct 17, 2006, 6:23:22 PM10/17/06
to Microcontroller discussion list - Public.
The manual for the PIC12F629/675 clearly indicates that the procedure
to write to the EEPROM is as follows:

; BUT, this WORKS at 5V, not at 3.3V
; write a byte in w EEROM @tmp
wreeerom:
bank1
clrf EECON1
movwf EEDATA
movf tmp,w
movwf EEADR
clrwdt
bsf EECON1,WREN
bcf intcon,gie
movlw h'55'
movwf EECON2
movlw h'AA'
movwf EECON2
bsf EECON1,WR
bsf intcon,gie
btfsc EECON1,WR
goto $-1 ;5mS wait max
bcf EECON1,WREN
clrf status ;bank 0
return

; the following WORKS at 3.3V and 5V
; write a byte in w EEROM @tmp
wreeerom:
bank1
clrf EECON1
movwf EEDATA
movf tmp,w
movwf EEADR
bcf intcon,gie
clrwdt
bsf EECON1,WREN
movlw h'55'
movwf EECON2
movlw h'AA'
movwf EECON2
bsf EECON1,WR
bsf intcon,gie
btfsc EECON1,WR
goto $-1 ;5mS wait max
bcf EECON1,WREN
clrf status ;bank 0
return
;
I spent many hours trying to resolve why this simple relocation of BCF
INTCON,GIE
allows the EEPROM to work at 3.3V as well. This is NOT an isolated case,
I have 50
PIC12F629's and 10 PIC12F675's doing the same thing.

My interrupt is trivial:

;*********************************************************;
; Tick interrupt
; Precisely 1.024mS with 4M Int RC Osc
;*******************************************************;
intv:
clrwdt
bcf intcon,t0if
incfsz count,f
nop
bsf flags,flg
retfie

I think that the manual has one instruction out of its proper place.
Anybody else notice
this?

--Bob
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Bob Axtell

unread,
Oct 18, 2006, 7:05:05 AM10/18/06
to Microcontroller discussion list - Public.
well, I see, once again, I am the only guy with problems. Nobody else seems
to have any...

--Bob

Tamas Rudnai

unread,
Oct 18, 2006, 7:29:08 AM10/18/06
to Microcontroller discussion list - Public.
Bob,

I thought that before waiting for the WR it is better to make a small delay
(1-2ms). Could it be happened that the eeprom writing procedure takes longer
if you are using lower voltage? I will make some tests in the evening with
my 675 playground if you want? (are you using the internal RC osc or
something else?)

Tamas

--
unPIC -- The PIC Disassembler
http://unpic.sourceforge.net

Bob Axtell

unread,
Oct 18, 2006, 8:35:30 AM10/18/06
to Microcontroller discussion list - Public.
Tamas Rudnai wrote:
> Bob,
>
> I thought that before waiting for the WR it is better to make a small delay
> (1-2ms). Could it be happened that the eeprom writing procedure takes longer
> if you are using lower voltage? I will make some tests in the evening with
> my 675 playground if you want? (are you using the internal RC osc or
> something else?)
>
>
That would be nice. to try. I'm in an awkward moment: all the code
except writing to the EEPROM
is written and tested. But these chips will not reliably program several
EEPROM bytes.

If I move the entire exact code to another device that I can debug
(PIC16F88) [except for GPIO etc]
the code runs perfectly, and the F88 programs ITS EEPROM correctly, too,
with the voltage as low
as 3V (my PS won't go lower). .

I'm really surprised Note: the ICD2 programmer can program the EEPROM
perfectly, but it gets 5V,
too....

- - - -

Yes, it IS supposed to operate slower at lower voltages. I never tried a
1mS delay before actually testing
the WR bit. I could do that, though...I'm exhausted now, up all night on
this...

-----

I have had more trouble with PIC nanowatt EEPROM than anything else in
the whole series.

--Bob

Dwayne Reid

unread,
Oct 18, 2006, 12:24:51 PM10/18/06
to Microcontroller discussion list - Public.
At 05:05 AM 10/18/2006, Bob Axtell wrote:
>well, I see, once again, I am the only guy with problems. Nobody else seems
>to have any...

Not at all, Bob.

All of my stuff still runs at 5V which is why I've never noticed this
problem.

That said, though, I *REALLY* appreciate hearing about stuff like
this. I've filed it with all the other little problems that have
been noted - said list is one of the first things I check when I run
into problems.

Thanks again for posting this - I highly suspect it will save me much
effort at some future date.

dwayne

--
Dwayne Reid <dwa...@planet.eon.net>
Trinity Electronics Systems Ltd Edmonton, AB, CANADA
(780) 489-3199 voice (780) 487-6397 fax

Celebrating 22 years of Engineering Innovation (1984 - 2006)
.-. .-. .-. .-. .-. .-. .-. .-. .-. .-
`-' `-' `-' `-' `-' `-' `-' `-' `-'
Do NOT send unsolicited commercial email to this email address.
This message neither grants consent to receive unsolicited
commercial email nor is intended to solicit commercial email.

Bob Axtell

unread,
Oct 18, 2006, 3:55:38 PM10/18/06
to Microcontroller discussion list - Public.
Dwayne Reid wrote:
> At 05:05 AM 10/18/2006, Bob Axtell wrote:
>
>> well, I see, once again, I am the only guy with problems. Nobody else seems
>> to have any...
>>
>
> Not at all, Bob.
>
> All of my stuff still runs at 5V which is why I've never noticed this
> problem.
>
> That said, though, I *REALLY* appreciate hearing about stuff like
> this. I've filed it with all the other little problems that have
> been noted - said list is one of the first things I check when I run
> into problems.
>
> Thanks again for posting this - I highly suspect it will save me much
> effort at some future date.
>
> dwayne
>
>

I have given up. I am redesigning the tiny PCB to accept the PIC12F629
PLUS an external EEPROM
that is guaranteed at 1.8V (24AA00). It is available in SOT23-5 (I have
size constraints).

Just to let everyone know: apparently MY batch of PIC12F629s will not
program its EEPROM below
3.3V. Everything else seems to operate below 3V (down to 2.5V). So I am
adding an external EEPROM
to replace the internal EEPROM. This chip operates on two wires using I2C.

--Bob

Tamas Rudnai

unread,
Oct 19, 2006, 5:22:43 AM10/19/06
to Microcontroller discussion list - Public.
Bob,

WDT does not occure I suppose? Also is there much longer time after reset
than 72ms?

Tamas


On 18/10/06, Bob Axtell <engi...@neomailbox.com> wrote:
>

--

unPIC -- The PIC Disassembler
http://unpic.sourceforge.net

Pearce, AB (Alan)

unread,
Oct 19, 2006, 5:36:30 AM10/19/06
to Microcontroller discussion list - Public.
>well, I see, once again, I am the only guy with problems. Nobody else
>seems to have any...

I happened to be looking at the errata sheet for the 16f627A/628A/648A
yesterday, and noticed EEPROM problems that look like they could be
related to what you see, for some revisions of the chips. Might pay to
look at it, and see if there is similar for the chips you are using.

Bob Axtell

unread,
Oct 19, 2006, 8:52:09 AM10/19/06
to Microcontroller discussion list - Public.
Tamas Rudnai wrote:
> Bob,
>
> WDT does not occure I suppose? Also is there much longer time after reset
> than 72ms?
>

hmmm. Might NOT be waiting before doing work, but EEPROM writes are
AFTER that point, about
600mS is soonest.

Good Q.

--Bob

Bob Axtell

unread,
Oct 19, 2006, 8:54:54 AM10/19/06
to Microcontroller discussion list - Public.
Pearce, AB (Alan) wrote:
>> well, I see, once again, I am the only guy with problems. Nobody else
>> seems to have any...
>>
>
> I happened to be looking at the errata sheet for the 16f627A/628A/648A
> yesterday, and noticed EEPROM problems that look like they could be
> related to what you see, for some revisions of the chips. Might pay to
> look at it, and see if there is similar for the chips you are using.
>
>
>
thanks, Alan, might just be what I am looking for.
Works at 5V, but I can't guarantee 5V.

Thanks again.

--Bob

Bob Axtell

unread,
Oct 19, 2006, 9:15:01 AM10/19/06
to Microcontroller discussion list - Public.
Pearce, AB (Alan) wrote:
>> well, I see, once again, I am the only guy with problems. Nobody else
>> seems to have any...
>>
>
> I happened to be looking at the errata sheet for the 16f627A/628A/648A
> yesterday, and noticed EEPROM problems that look like they could be
> related to what you see, for some revisions of the chips. Might pay to
> look at it, and see if there is similar for the chips you are using.
>
>
>
I just got through studying them, and since the PIC12F675 and PIC16F628
have identical EEPROM
peripherals (right down to the same banks), I think you are right on...

When I was testing, I caught one device writing 2 bytes correctly, but
not all 6. Very odd. And THAT was
at 5V, too. I'm guessing that there is a problem with the WR bit at all
voltages, but because the write time
lengthens with lower voltages, the problem occurs more often. Hows that
for an explanation (or excuse)?

--Bob

Jan-Erik Söderholm

unread,
Dec 6, 2006, 4:52:15 AM12/6/06
to Microcontroller discussion list - Public.
Just FYI...

Currently having problems with www.microchip.com.

"Content Server Request Failed"
"Content Server is too busy to handle request."

Well well...

Jan-Erik.

WH Tan

unread,
Dec 6, 2006, 5:27:18 AM12/6/06
to Microcontroller discussion list - Public.


Sounds OK here, but it looks strange!

There is a new banner on top read "STELLENT"...and there is a menu on
that banner: " Login Microsoft Login Home ....." Don't know
what's that!


Best regards,

--
WH Tan

Alan B. Pearce

unread,
Dec 6, 2006, 5:29:50 AM12/6/06
to Microcontroller discussion list - Public.
>Just FYI...
>
>Currently having problems with www.microchip.com.
>
>"Content Server Request Failed"
>"Content Server is too busy to handle request."
>
>Well well...

Clicked on link in your message and it came straight up. 10:28 GMT.

Xiaofan Chen

unread,
Dec 6, 2006, 5:37:59 AM12/6/06
to Microcontroller discussion list - Public.
On 12/6/06, WH Tan <whsiu...@gmail.com> wrote:
>
> Sounds OK here, but it looks strange!
>
> There is a new banner on top read "STELLENT"...and there is a menu on
> that banner: " Login Microsoft Login Home ....." Don't know
> what's that!
>
>
Same thing here in Singapore. But once you refresh it will be okay.

Alan B. Pearce

unread,
Dec 6, 2006, 6:01:21 AM12/6/06
to Microcontroller discussion list - Public.
>> There is a new banner on top read "STELLENT"...and there is a menu on
>> that banner: " Login Microsoft Login Home ....." Don't know
>> what's that!
>>
>>
>Same thing here in Singapore. But once you refresh it will be okay.

I found it varied. Sometimes it had the Stellent frames, and sometimes
didn't. Once I tried to access other pages than the front one it did seem
very slow.

Reply all
Reply to author
Forward
0 new messages