avr-gcc ,hazudik az if:-)

Pal Lukacs ekegep at yahoo.com
Mon Sep 11 12:35:54 CEST 2006



Moczik Gabor <pm at progzmaster.hu> wrote:void keywait() {
     unsigned char debounce;

     while(!BUTTON_0);
     debounce=0;
     while(debounce<200) {
         if (BUTTON_0) debounce=0; else debounce++;
     }
}

Az elso while arra van, hogy var ameg elengedik a gombot, ha esetleg 
elozoleg folyamatosan nyomtak volna.

A lenyeg a masodik while ciklus, akkor enged kilepni, ha 200 ciklus alatt 
folyamatosan 0 (=AKTIV) allapotot olvas be.

De altalaban mas modszert szoktam hasznalni.
   
 Ok,akkor maradhat a delay-es megoldas,vagy a timer1 ovf.ps megoldas.
   
 Koszonom mindenkinek!
 

 		
---------------------------------
Stay in the know. Pulse on the new Yahoo.com.  Check it out. 


More information about the Elektro mailing list