Interrupts getting ignored

6v6gt:
OK. This is a potential source of error:

void dec()

{
  chiran --;
  EEPROM.write(address, chiran);
  ang = false;
}





1. chiran is declared as a (signed) int and your EEPROM.write can write only a single (unsigned) byte. It will cause a mess also if chiran goes negative. You should use EEPROM.put and EEPROM.get instead.

2. The EEPROM has a limited lifetime (number of write operations). Writing to it in the loop() is not generally a good idea. Do you have to maintain the status of the system after it is switched off ?
  1. Considering your first point, it works well when I fetch and compare minutes instead of hours. But when hours are fetched from RTC and compared the problem arrises. Even if I assugn fixed values to variables nil and yogesh everything works fine. Problem only arrises whrn I fetch the hours and save it in nil and minutes in yogesh and compare them in the next loop. If EEPROM.write and EEPROM.read was the problem then it shouldn't have worked in these cases I guess.

  2. Yes I need to save those values each time on eeprom so as to get them back when the power resumes after failure