I am wondering how to detect worm/cold reset in T89C51RD2. According to the data sheet there's a bit (POF) in PCON register that he should be high at worm reset, but for some reason it's not working. One of the first things I'm doing when program starts is to check this bit and if the bit is high then I initialize some parameters otherwise not. After running the program I sow that the bit value is always low no matter what kind of reset I do (switching power off, pressing reset switch, or in software jumping to address 0x0000). P.S. My software is based on RTX full and I check this bit in the following way: if (PCON & 0x10) buffs_init(); Does someone have a solution for that? Thanks for any help, Ruven
Please read not only Device Datasheets but Errata aswell. Read http://www.atmel.com/dyn/resources/prod_documents/doc4101.pdf it says: 14. Power-on Flag Power-on Flag does not work. Workaround None.
Hmm, it says "workaround None". Well, in fact there is not 100% guarantee way to recognize warm/cold reset when POF does not work, but... You may use alternative way to do it. Reading Atmel Data Book, it says that the internal RAM is not affected by reset. from other side, on power-up the RAM content is inderterminate. Do you undertand an idea? Mark some bytes of RAM with control sequence and check it at each reset. For example, check bytes from address 0x30 for 0xAA, 0x55, 0xСС 0x33 etc. If they are same true then it is warm reset, if not - put these values at a location and go to cold reset routine. Well, it is not 100% way because random values are random values... Moreover I am not sure that warm reset does not affected RAM for your device part number... Good days!
Thanks a lot Oleg, I'll make some work arounds.