I have made a event counter using 89C51 and the count value is displayed on 7 segment display .The problem is that whenever the power supply fails and resumes again the counter resets and displays 0 count and it again starts counting .
Can anyone tell me how do i save my counter values so that on resumption of power supply it starts counting from the same point where it was interrupted due to power supply failure .
you should use one eeprom , (89c51 doesn't have eeprom ),then save the count in it , after every pulse (count ) , so when the power supply disconnects , the count is saved in eeprom , you should change your programm to check eeprom after starting .
I am extremely thankfull for your valued suggestions . But i have never used eeprom . Can u send me a schematic as to how do i interface eeprom with 89c51 and Assembly code to interact with eeprom .
Schematic is quite simple. All you need is two port Pins for I2C device. One pin for SCL (serial clock) and other for SDA (serial data). A 4.7k pull-up ressitor is recommended on both pins.