Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Required sequence for writing EEPROM

Status
Not open for further replies.

MathGeek

New Member
What I don't understand is WHY i have to write 55h and then AAh to EECON2 before I start writing EEPROM on Midrage PICs. Why?

It seems that EECON2 exists only for that reason.
 
I suspect that is the only reason for EECON2...

The 55h / AAh "unlock" sequence helps reduce the chance of accidentally writing the EEPROM with a run-away program or during power-up or power-down...

Regards, Mike
 
Microchip calls it the "special 5 instructions sequence". I don't think there is a rational explanation. That's just the way it works. Set the address location to be written, the data you wanna write and tell the EEPROM device with the "special 5 instructions sequence" to write it.

I like to think of it like being secret codes used by baseball coaches to call a bunt for example. The coach's not gonna yell "hey, hit a bunt!". He's gonna touch his nose, clap his hands, lift his cap and spit in the air. The batter understands the *sequence* as "hit a bunt".

Sorry if you're not familiar with baseball ;)
 
Just to confirm, from 16F88's datasheet, page 27 :

EECON2 is not a physical register. Reading EECON2
will read all ‘0’s. The EECON2 register is used
exclusively in the EEPROM write sequence.
 
MathGeek said:
What I don't understand is WHY i have to write 55h and then AAh to EECON2 before I start writing EEPROM on Midrage PICs. Why?

It's VERY simple, EEPROM corruption is an extremely common occurance, both in internal EEPROM and external EEPROM, and is actually one of the largest causes of TV faults today.

By making the conditions for writing to the EEPROM fairly complicated it helps to ensure greater reliability of the data stored there. These specific conditions are highly unlikely to occur by accident or during a device crash.
 
Nigel Goodwin said:
MathGeek said:
What I don't understand is WHY i have to write 55h and then AAh to EECON2 before I start writing EEPROM on Midrage PICs. Why?

It's VERY simple, EEPROM corruption is an extremely common occurance, both in internal EEPROM and external EEPROM, and is actually one of the largest causes of TV faults today.

By making the conditions for writing to the EEPROM fairly complicated it helps to ensure greater reliability of the data stored there. These specific conditions are highly unlikely to occur by accident or during a device crash.

I see..........but the numbers 55h and AAh seems totally out of blue.

So random!
 
Other memories as well...?

Is it possible that some serial EEPROMs used that sequence as well?

I vaguely recall using that one for a serial EEPROM, long time ago.

May I be wrong?

Anyone :shock: ?
 
Jay.slovak said:
I wouldn't say so!
55h = 01010101b
AAh = 10101010b

See that? :lol:

Oh, I see, they are 1's complement.

55h+AAh=FFh

That reminds me of some math prof's problem, where it could be solved only in binary system. No one got it. :)
 
MathGeek said:
Oh, I see, they are 1's complement.

Sorry mate, they are just alternate bit patterns. Nothing to do with maths.

MathGeek said:
That reminds me of some math prof's problem, where it could be solved only in binary system. No one got it.

Like this one? "There are 10 types of people. Those who know binary and those who don't."
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top