interrupts

Farkli zaman araliklarinda calisan 2 interrupt

int main () 
{
    timer_1.start();
    timer_2.start();

    while(){
        if(timer_1.read_ms()>=200){
            task_1();
            timer_1.reset();
        }
        if(timer_2.read_ms()>=1000){
            task_2();
            timer_2.reset();
        }
    }
}

void task_1(){
    // do something
}

void task_2(){
    // do something
}
  • Scheduled programming need to be careful with the amount of code how long it takes to execute
  • İf we need to run a task every 1 ms, task must take less than 1 ms.
  • Need to prioritize the tasks. Because (in the above example) both tasks will want to run at the same time after 2000 msec.

kaynak