Keil Logo

swatch

Summary
void swatch (
  float seconds);   /* seconds to delay */
Description

The swatch debugger function is used in a debugger signal function to delay until the specified number of seconds has elapsed. While this function delays, your target program continues to execute. This function is accurate even when used with devices that have slow clock or power-saving modes.

Note

  • The swatch debugger function may be called from within a signal function only. Calls to swatch from outside a signal function are not allowed and result in an error message.
Return Value

None.

See Also

twatch

Example
signal void int0_signal (void) {
  while (1) {
    PORT3 |= 0x04;             /* pull PORT 3.2 high   */
    swatch (0.05);             /* wait 50 milliseconds */
    PORT3 &= ~0x04;            /* pull PORT 3.2 low    */
    swatch (0.05);             /* wait 50 milliseconds */
  }
}

The following call starts the above signal function which toggles port 3.2 every 50 milliseconds.

> int0_signal ();
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.