Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Microcontroller question

  1. Nov 5, 2013 #1
    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?

  2. jcsd
  3. Nov 5, 2013 #2
    It's to help prevent runaway code execution from overwriting the eeprom.
  4. Nov 6, 2013 #3

    But why use 0x55 and 0xAA why not some other random hex numbers?
  5. Nov 6, 2013 #4


    User Avatar
    Science Advisor
    Homework Helper

    Because that is how the chip was designed to work. There isn't the answer to a question about life, the universe, and everything here.

    Of course it's probably not a coincidence that two values are 01010101 and 10101010 in binary. And EECON2 is not a physical register either. http://ww1.microchip.com/downloads/en/DeviceDoc/31007a.pdf section 7.4
  6. Nov 6, 2013 #5
    That's what I ment, the values were perfectly opposite (I mean NOT(01010101) is 10101010).
    Anyways thanks for the answer and link
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook