ist bei mir auch fast so, interen Clock 8MHz dauert bei wait zu lange,Zitat von Emotionslos1
wait25 wird bei mir bei wait 19,5 erreicht, Abhilfe wait tunen oder die Oszillator clk
void _delay_up25(UBYTE n)
{ UBYTE tmp;
#ifdef F_CPU8000000
for(tmp=0; tmp<(n); tmp++)
_delay_ms(19.5);
#else
#ifdef F_CPU4000000
#else
#warning F_CPU4000000 not defined
#warning F_CPU8000000 not defined
#endif
#endif
} // void _delay_up50(UBYTE n)
aber ich nutze wait fast nicht mehr, habe eine IRQ auf einen 1ms Timer, dort zähle ich variablen hoch und die kann ich auf overflow prüfen, dann kann der prozzi noch was anderes tun ausser wait....
SIGNAL (SIG_OUTPUT_COMPARE2)
{ cli(); //Global Interrupt Disable
dcf.msec++; // Zeitgeber für DCF-Empfang weiterdrehen
fast_it++;
_ms++;
_500ms++;
if(dcf.msec>30000)
dcf.msec=0;
if(_500ms>1500)
_500ms=0;
if(_ms>1500)
_ms=0;
sei(); //Global Interrupt Enable
}
void cont_ausloesung(void)
{ if(bit_is_clear(PORTB, _camAUS_PB))
{ PORTB |= (1 << _camAUS_PB); // Cam Auslöser an
w0=fast_it+cam_delay;
}
if(fast_it>w0)
{ PORTB &=~ (1 << _camAUS_PB); // Cam Auslöser aus
_ausloes=0;
}
} // void cont_ausloesung(void)
void ausloesung(void)
{ PORTB &=~(1 << _camAUS_PB); _ausloes=1; cont_ausloesung();
}







Zitieren
Lesezeichen