PIC EEPROM EEIF flag polarity

Just wondering if someone could suggest a workaround for this snippet of pseudo code:

if ( eeif == 1 ) { eeif = 0 // write eeprom }

This piece of code (written in assembly) goes into the main loop of my program and allows the main loop to continue executing while the EEPROM takes its leisurely 8ms to write.

The problem is that on power-up eeif == 0, and this code can never execute because eeif is only asserted at the end of a write. The only time writing can take place is via this code.

I thought about doing a dummy write on initialization as a brute force solution to assert eeif but it seems to me a waste of an eeprom cell.

Reply to
chinsta00
Loading thread data ...

Hi, Instead of doing a dummy write you could simply set EEIF in software. This flag is writeable. hth,

--
Andrzej Ekiert
http://www.ekiert.com/
Reply to
Andrzej Ekiert

Why not just check WR ?

eg: if (WR==1) { DoWhateverIsNeededWhileEepromBusy(); }

Reply to
Rocky

Reply to
chinsta00

Reply to
chinsta00

They do. The section documenting each SFR has an "R" and/or a "W" above each bit indicating whether it can be read or written, along with its default value.

--
John W. Temples, III
Reply to
John Temples

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.