augustinetez
Active Member
This is just a general enquiry to see how others have handled things and any pitfalls re saving data to EEprom on powering down.
I currently use an interrupt that generates a user settable (at program time) x number of seconds delay (can be anywhere from 1 to 255 seconds).
This is used to save 5 bytes of data after the user has stopped turning an encoder for the above mentioned delay period.
It was done this way as there are no spare pins in the current project to implement a power down save which is all that is actually required so settings can be restored on the next power up.
Now that I'm porting the project over to a bigger PIC (ref my previous "New set of eyes" post), I will have a spare pin that can be assigned to a falling edge interrupt to trigger the save.
Based on the 16F1827 datasheet, I figure that at worse, I need 30mS to perform this (25mS to actually save the data and an extra 5mS to cover the interrupt/program overhead plus a bit spare).
I haven't got as far as the actual triggering mechanism yet so open to suggestions on the hardware as well.
I currently use an interrupt that generates a user settable (at program time) x number of seconds delay (can be anywhere from 1 to 255 seconds).
This is used to save 5 bytes of data after the user has stopped turning an encoder for the above mentioned delay period.
It was done this way as there are no spare pins in the current project to implement a power down save which is all that is actually required so settings can be restored on the next power up.
Now that I'm porting the project over to a bigger PIC (ref my previous "New set of eyes" post), I will have a spare pin that can be assigned to a falling edge interrupt to trigger the save.
Based on the 16F1827 datasheet, I figure that at worse, I need 30mS to perform this (25mS to actually save the data and an extra 5mS to cover the interrupt/program overhead plus a bit spare).
I haven't got as far as the actual triggering mechanism yet so open to suggestions on the hardware as well.