, . , , , , .
, / , . 10 000 / "interrupt_counter" , "wait 1 ms" :
extern volatile unsigned long interrupt_counter;
unsigned long temp_value = interrupt_counter;
do {} while(10 > (interrupt_counter - temp_value));
, , 900 1000 . - , 1000 1100. - 1 & middot; , - 1 , :
extern volatile unsigned long interrupt_counter;
unsigned long temp_value = interrupt_counter;
for (int i=0; 5>i; i++)
{
do {} while(!((temp_value - interrupt_counter) & 0x80000000));
temp_value += 10;
do_action_thing();
}
This should be done do_something()at exact intervals, even if they take several hundred microseconds. If they sometimes take 1 μs, the system will try to start each of them at the “right” time (so if one call takes 1.3 Moscow time and the next is completed instantly, the next will be 700 μs later).
source
share