Need help to store data to eeprom

OK. Now use those two examples in your sketch

ok thanks, so which locations in the code to put those two functions?

This is becoming tedious.

I have forgotten why you want to do this in the first place. Please remind me

You get() the value where you want to get the value from the EEPROM. You put() the value where you want to put the value in the EEPROM

i have tried to modify it like this...

#include <EEPROM.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
unsigned long flow = 0;
float Litres;
int Address = 0;
byte count = 0;
byte digits = 6;
long buff;

void setup()
{
  EEPROM.get(Address, Litres);
  lcd.begin(16, 2);
  attachInterrupt(digitalPinToInterrupt(2), isr, FALLING);
  lcd_initialize();
}

void loop()
{
  Litres = flowmeasure() / 1000.0;
  EEPROM.put(Address, Litres);
  buff = Litres;
  if (buff == 0)
  {
    count = 1;
  }
  while (buff != 0)
  {
    count++;
    buff /= 10;
  }
  digits = digits - count;
  lcd.setCursor(digits, 1);
  lcd.print(Litres, 3);
  count = 0;
  if (flow >= 449999550)
  {
    flow = 0UL;
    lcd.clear();
    delay(100);
    lcd_initialize();
  }
}

void isr()
{
  flow++;
}

float flowmeasure()
{
  float flowcount;
  flowcount = (flow / 0.45);
  return flowcount;
}

void lcd_initialize()
{
  lcd.setCursor(0, 0);
  lcd.print("LITRES  CONSUMED");
  lcd.setCursor(0, 1);
  lcd.print("000000.000Litres");
}

and when i try to simulate in proteus am getting this output

i don't know why am getting that error

STOP RIGHT NOW

There is a limit as to how many times you can safely write to an EEPROM location before it is damaged. That limit is about 100,000 times

If you run your sketch on a real Arduino you may damage it because loop() runs thousands of times per second and you put() an value to EEPROM each time.

Luckily for you the put() command only writes to the EEPROM if the value has changed. This will help, but as float values are not very precise they will change frequently

As to your problem, I have not looked in detail but any variable changed in an ISR and used outside of it should be declared as volatile to warn the compiler that it could change at any time and to allow for this

so what is your suggestion sir?

Another consideration is this line of code

  flowcount = (flow / 0.45);

flow is a multi byte variable (unsigned long) to the calculation above will take several clock cycles to execute and an interrupt could occur at any time during that process. Guard against this by disabling interrupts, copying flow to another variable then enabling interrupts again then do the calculation on the copy

help me to modify that code above sir please.....

Modify it to do what ?

Apart from the issue with EEPROM.put() being executed frequently, what is the problem ?

ok so what another way i can use to store data permanently?

An SD card maybe

is it safe to use it in water meter? what about external eeprom?

It will be safe if you make it waterproof but the same goes for the whole system. An external EEPROM will have write limitations too but you would need to check

What exactly is the application for the sketch ?
Do you really need to check each time through loop() or could you do it less frequently ?
How many decimal places are you actually interested in ?
What is it that provides the signal to trigger the ISR ?

Come to that, please describe the project as a whole
449999550 what is this magic number ?

i want to design a smart water meter system that will be powered by 3.7v lithium battery sir

That puts a whole different perspective on the requirements. How long do you expect the battery to last for when powering the project and which type of Arduino (or other board) are you planning to use ?

i want to use stm32l151cc which is a low power microcontroller sir and i will use arduino ide to program it

That is a processor that I know nothing about

How accurately do you need to know what the water consumption is and at what frequency ? For instance, would it be good enough to read the consumption every minute but only save it every hour ? As you can imagine, this would drastically reduce the number time that the EEPROM is written to.

You could also consider implementing wear levelling on the EEPROM so that you don't constantly write to the same address. How complicated do you want to make this ?

With the small amount of power available I think that you can rule out the use of an SD card to save the data

ok what other controllers will be suitable for this that will consume too low power in uA?