This is an old revision of the document!


Table of Contents

Verzögerung

Dieser Teil der Bibliothek enthält Funktionen um Verzögerungen in einem Programm mit Software Alhorythmen oder mit Hardwaretimern zu generieren. Verzögerungen blocken keine Interrupts, daher werden Softwareverzögerungen durch Interrupts unterbrochen. Verzögerungsfunktionen sind nicht vorkompiliert, um sie mit verschiedenen Taktfrequenzen zu nutzen.

Funktionen

  • void sw_delay_ms(unsigned short count)

Software delay in milliseconds. Function expects the usage of some compiler optimization mode. Parameters:

  • count - Delay time in milliseconds. 0 to 65535 ms.
  • void sw_delay_us(unsigned short count)

Software delay in microseconds. Function expects the usage of some compiler optimization mode. Parameters:

  • count - Delay time in microseconds. 0 to 65535 μs.
  • void hw_delay_ms(unsigned short count) \\'

Hardware timer based delay in milliseconds. Functions use ATmega128 8-bit timer 0. Depending of the clock frequency, up to several milliseconds delay error may occur. Parameters:

  • count - Delay time in milliseconds. 0 to 65535 ms.

Beispiele

Demonstration von beiden Typen einer Verzögerung

#include <homelab/delay.h>
 
int main(void)
{	
	// Software base delay of 100 ms.
	sw_delay_ms(100);
 
	// Hardware timer based delay of 100 ms.
	hw_delay_ms(100);
}
de/software/homelab/library/delay.1281707135.txt.gz · Last modified: 2020/07/20 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0