I enter the interruption every 100ms and increment a counter(variable count)
in the main function, I will have something like this.
int count1 = 10; //will run every 10s
int count2 = 100; //will run every 100s
int count3 = 1*3600; //Will run every hour
int count4 = 2*3600*24; //will run every 2 days
while (true)
{
if(count>=10) //If count is 1 seconds
{
count = 0;
if(!(--count1)) //Call function1
{
function_count1();
count1 = 10;
}
if(!(--count2)) //Call function2
{
count2 = 100;
function_count2();
}
if(!(--count3)) //Call function3
{
count3 = 3600;
function_count3();
}
if(!(--count4)) //Call function4
{
count1 = 2*3600*24;
function_count4();
}
}
}
I think it will better with my red corrections (see above).
zuisti