|An Introduction & Guide to JALV2|
|Prev||Chapter 11. Built-in Functions|
_usec_delay(cexpr) is useful when an exact delay is required. It generates code that is guaranteed to delay a given number of micro-seconds. This is done using loops with one, two, or three variables, and no-op instructions as necessary.
For _usec_delay to work correctly, interrupts must be disabled, and `PRAGMA TARGET CLOCK' must be issued to set the system clock speed.
Note that _usec_delay() will generate delays up to 4,294.967295 seconds (or ~71.5 minutes), this isn't really the best use of space. On a 20MHz 16f877 this required 1043 instructions.
This is typically used for delays of a few 10s or 100s of uSec.