はっくはっくキッチン
Hack Hack Kitchen

wait.asm

 2021/12/12

This program provides basic wait routines. This code is a part of pAVRlib.

In examples/ and examples-C/ you'll find small test programs.

Initialize

Define F_CPU.

.equ F_CPU = XXXXXX	; system frequency in Hz

e.g.

.equ F_CPU = 1000000	; in case of f = 1 MHz

F_CPU > 30 MHz is not supported (yet).

Subroutines

These routines are not so exact (ca. 1-2 % error). Use timer if you need exact delays.

void Wait1ms() (in: (none), out: (none))

wait ca. 1 ms

void Waitms(unsigned char) (in: r24, out: (none))

wait ca. n ms (n = r24)

void Waitmsint(unsigned int) (in: r25:r24, out: (none))

wait ca. n ms (n = r25:r24)

void Wait1sec() (in: (none), out: (none))

wait ca. 1 s

void Waitsec(unsigned char) (in: r24, out: (none))

wait ca. n s (n = r24)

Example

To wait 5 seconds, use:

	ldi	r24, 5
	rcall	Waitsec

Using with GCC

This program can be used with GCC, but it is recommended to use the standard library.

See examples-C/wait-test.c.