Why Must EECON2 Be Initialized with 0x55 and 0xAA in PIC18F EEPROM Programming?

  • Thread starter Thread starter Magna Visus
  • Start date Start date
  • Tags Tags
    Microcontroller
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
4 replies · 3K views
Magna Visus
Messages
23
Reaction score
0
Hello all,

Those who usually program microcontrollers in assembly, should be well familiar with the internal EEPROM (Series PIC18F).

In particular there's a register EECON2, that needs to be initialized ALWAYS with 0x55 then 0xAA before writing;
Why is that? What's the main reason behind these proper values?

Thanks.
 
Engineering news on Phys.org
It's to help prevent runaway code execution from overwriting the eeprom.
 
Thanks!

But why use 0x55 and 0xAA why not some other random hex numbers?
 
That's what I ment, the values were perfectly opposite (I mean NOT(01010101) is 10101010).
Anyways thanks for the answer and link