Hello All,
Below i have given all the details related to my problem but not able to solve it i think problem is in isr code. If anyone one have any idea let me know , also attached the code below in text form i am using a pic16f676 for which i am using internal oscillator for time calculation but it is not stable i have used 4 mhz osc but getting not getting the correct calculated time using isr
Then i try using a same pic(mcu) for which i am using external oscillator for time calculation but it is also not stable i have used 8 mhz osc and also 32.768.khz external osc also but not getting the correct calculated time.
i will brief about that in my code i am calculating the total run time of motor when it is running otherwise not, depending on the hours calculated i have to turn ON three led's with buzzer but it does not work when i try it with internal oscillator of pic16f676 then i also tried external oscillators i.e 8 Mhz and 32.768Khz but the problem remains same i am not getting the correct o/p i.e led's are not turning ON at the right time instead of that it will turn ON at 285 hrs 5 mins and some times 285 hrs 5mins 45 sec means oscillator is of varying nature, same i tried to turn on the led's at the 1 hrs interval then in first hour one led is ON but at 1 hr 20 sec, in 2nd hr it turn ON at 2hrs 40 sec ..... then 3 hrs 1 min .... then 4 hrs 1 min 15 sec i have observed that every hour 20 sec delay is added in my time calculation every hour ----> in this case i have forcefully call my led turn ON function( EOL func ) in which i observed that scenario.
but when i call my EOL function from my pump_control_module then i delay addition is more and more delay is added every hour
when i am not getting the correct output then i call my EOL_module function from isr this will some how reduce my problem not all. It will not give problem if it works for small time measurement but for time calculation over 600 hrs it effects my project severly