View Single Post
Old 12th Sep 2011, 5:23 pm   #113
julie_m
Dekatron
 
Join Date: May 2008
Location: Derby, UK.
Posts: 7,735
Default Re: 4 Digit Up/Down Counter IC?

To get the count to survive power failures, you will need a large electrolytic capacitor across the PIC, big enough to store enough energy to keep it going long enough to write the E²PROM, and wired via a diode so the only thing that can draw any current from the cap is the PIC itself; and an input, driven from the power transformer, upstream of the rectifier and smoothing can, to indicate that mains is present. After a few missed mains cycles, but before the capacitor is too depleted to keep the µp alive, write the present count value to E². On power-up reset, read the value from E².

If you have another I/O line to spare, you could even assert it when all four digits are zero. This could then be used to disengage the mechanism solenoid, so providing a "memory" function as found on some VCRs.
__________________
If I have seen further than others, it is because I was standing on a pile of failed experiments.
julie_m is offline