I have the following C code:
int count = 0; // relative time
int T1 = 20; // period 1 in ms
int T2 = 50; // period 2 in ms
int T3 = 80; // period 3 in ms
while (1) {
if (count%T1 == 0) function1();
if (count%T2 == 0) function2();
if (count%T3 == 0) function3();
count++;
if (count == T1*T2*T3) count = 0;
delay(1); // wait for 1 ms
}
I'd like to know the reason for which there is the integer division count%T1==0 instead of count==T1. Maybe it takes into account the fact that the period T1 may not be an integer?
Thank you in advance.