Hallo,

Es handelt sich um Atmega8L und GCC compiler.

Timer1 generiert jeden 10ms ein overflow interrupt.

  • volatile unsigned int Count;

    SIGNAL (SIG_OVERFLOW1){
    Count+=10;
    }

    WaitFunction(unsigned int Compare){
    Count=0;
    while(Count < Compare); //instabiel
    while(Count != Compare);//immer stabiel
    }


Kann mir Jemanden erklaher warum die function WaitFunction(500) mit 'while(Count < Compare)' meistens 500ms wartet aber ab und zu viel kurzer (so etwas wie 200ms) wartet und dagegen '(Count != Compare)' immer stabiel ist????

Gruss

Henk