Delay Routines

The delay routines supplied with Basic 18 can generate a lot of inline code, rather than call subroutines. The routines described here cause minimal inline code to be generated.

The timings include the calling sequence, and will be exact for a uInteger argument, or a constant greater than 255. For a byte argument, or a constant less than 256, the timing will be one instruction cycle shorter (e.g. 1 usec at 4 mHz).

The routines only support clock frequencies of 4, 8, 10, 12, 16, 20 and 40 mHz. For other frequencies, you should use the Basic 18 Delay routines.

The pauseus routine has a minimum delay, due to overhead, which will range from 4 instruction cycles for a 40 mHz clock to 27 instruction cycles for a 4 mHz clock. See the comments in the individual routines for the exact numbers.

Click on the routine name to see the code.

Pauseus(n as uInteger)

Pause for n microseconds.

Pausems(n as uInteger)

Pause for n milliseconds.