delay_100ns Statement

The delay_100ns statement causes the processer to wait a short time.

The time interval is measured in units of 100 nanoseconds (that is 0.0000001 seconds)

The minimum delay period is 1 unit (1 * 100 nanosecond), the maximum delay period is 255 units (255 * 100 nanosecond = 0.0000255 seconds which is 2.55 microseconds).

The minimum delay is actually determined by the microcontrollers instruction execution speed. For a PIC running at 4MHz the minimum delay possible is 1000 nanoseconds. For a PIC running at 20MHz the minimum delay possible is 200 nanoseconds. The delay produced by the delay_100ns statement may be more than required (due to the physical constraints of the PIC) but will never be less than required.

syntax

delay_100ns dly

where dly is the number of units to wait (NOTE dly must be a constant)

NOTE: If interrupts are enabled and interrupts occure during the execution of the delay_100ns statement then the delay may become much longer than required. If accurate delays are required, then interrupts should be disabled. If interrupts are disabled then beware that some other high priority activity (which is serviced by the interrupt) may be neglected and possibly ignored completely.