µVision User's Guide

legacy

_sleep_

Summary
void _Sleep_ (ulong milliseconds) /* Delay script n milliseconds */
Description

The _sleep_ function may be used to delay script execution in debug functions or signal functions. The _sleep_ function is useful to allow small delays in the script language execution and can be used in simulation mode and target debugging mode.

Return Value

None

Example

The following script switches the oscillator on an ARM device for fast download speed.

// Switching from Slow Clock to Main Oscillator for faster Downloading
_WDWORD(0xFFFF4020, 0x002F0002);     // APMC_CGMR: Enable Main Oscillator
_sleep_(10);                         // Wait for stable Main Oscillator
_WDWORD(0xFFFF4020, 0x002F4002);     // APMC_CGMR: Switch to Main Oscillator