I recently posted my Question in the german forum but I think I will try it internationally (please forgive me my bad english).
I want to develop a Motor counter on my MIAC (later on a custom PICmicro Board), that counts the usage of up to 4 motors in hours. The resolution should be 1sec or max. 10 seconds .
So I would need a interrupt that comes every 1 or 10 seconds and increment my counter variable (unsigned long int myMotor1CounterInSeconds) if the motor is active.
I also would like to backup the counter values in my EEPROM area so if the MIAC remembers his counter values in case of reset or power loss.
Would this a possible way? or is their a better one?
Code: Select all
Start->VarInit->Check if there are values >0 in EEPROM
-> if yes take this values as countervariables - else go on
-> generate interrupt every x seconds
-> while [ calculate seconds in hours and -> output on display + gui ]
Interrupt routine:
Motor1 acitve? if yes counter1++ if not go one ->
Motor2 acitve? if yes counter2++ if not go one ->
Motor3 acitve? if yes counter3++ if not go one ->
Motor4 acitve? if yes counter4++ if not go one ]Thank you for your help.
Sven