Habe ich es richtig verstanden: das Delay hat keinerlei Auswirkung auf die Hardware, nur die Code-Ausführung wird angehalten? Im konkreten Beispiel geht es um den Analogkomparator nach dem Einschalten. Das Datenblatt sagt: "During the start-up time after enabling the AC, the output of the AC may be invalid. The start-up time of the AC by itself is at most 2.5 µs. If an internal reference is used, the reference start-up time is normally longer than the AC start-up time." In diesem und ähnlichen Fällen kann ein Delay bedenkenlos verwendet werden. Richtig?
1 | AC0.CTRLA = AC_LPMODE_bm | AC_ENABLE_bm; // analog comparator low-power mode, enable analog comparator |
2 | __builtin_avr_delay_cycles(333); // delay 100µs @ 3.333333 MHz |
3 | if(AC0.STATUS & AC_STATE_bm) // if analog comparator output is HIGH |
4 | {
|
5 | . . . . . . . |
6 | }
|