I'm thinking of ways to implement a nearly non-volatile counter using flash and RAM. Idea is to count events in a RAM counter and write the count to flash every n times. At first I thought I'd just use successive locations in flash until I need to reformat the entire sector but I'm thinking it may be better to flip single bits from 1 to 0 with each bit indicating n events. That way I don't waste an entire DWORD for each update.
Does anybody know of a ready-made solution for this kind of thing?