![]() ZBasic System Library
108
ZBasic Microcontrollers
Type
Subroutine
Invocation
DelayCycles(count)
Parameter
Method
Type
Description
count
ByVal
constant integral
The number of CPU cycles to delay.
Discussion
This routine effects a delay for at least as long as the specified number of cycles. The actual delay may
be longer if interrupts are enabled, i.e. the delay will be extended by the amount of time required to
service any interrupt that occurs. Further, if a task switch occurs (which will occur only if interrupts are
enabled), the delay will be extended further until the task containing the delay resumes execution.
The delay is effected by executing a series of instructions in a loop repeatedly and possibly executing one
or more NOP instructions to consume at least the specified number of cycles.
Example
Do
Call PutPin(pin, 0)
Call DelayCycles(20)
Call PutPin(pin, 1)
Call DelayCycles(20)
Loop
This loop causes the pin to go low and then high alternately for approximately 20 cycles each.
Compatibility
This subroutine is only available for native mode devices and is not available in BasicX compatibility
mode.
See Also
Delay, DelayMilliseconds, DelayUntilClockTick, Pause, Sleep, Register.RTCStopWatch
|