164
Pause
Type
Subroutine
Invocation
Pause(time)
Parameter
Method
Type
Description
time
ByVal
Single or int16
The amount of time to pause, in seconds
(Single) or Timer 0 ticks (int16)
Discussion
This routine suspends execution of the current task for approximately the period of time specified. No
other task is allowed to run during the pause period. The resolution of the time period is approximately
4.34µS with a maximum pause time of about 284mS. Note that the accuracy of the pause may be
affected by the time required for the processor to service interrupts (RTC, serial channel, etc.). Also note
that the resolution of the pause is similar to the minimum execution time for user instructions. This means
that timing using Pause() calls of less than 20 to 50 units or so will be affected significantly by the
succeeding instructions.
This routine should be used instead of Sleep() or Delay() when higher resolution timing is required or
you dont want a task switch to occur. If you need longer pauses than can be produced by this routine,
you can implement them using Register.RTCStopWatch.
Example
Do
Call Pause(0.010)
' a 10 millisecond delay
Call Pause(2304)
' a 10 millisecond delay
Loop
This loop produces a square wave signal on pin 12 at approximately 50Hz (with some jitter due to
handling interrupts).
Compatibility
This routine is not available in BasicX compatibility mode.
See Also