Keil Logo

Push Button

The following signal function toggles an I/O pin simulating a connected switch.

/*----------------------------------------------------------------------
  Toggle I/O Pin
----------------------------------------------------------------------*/
SIGNAL void toggle_IO_pin()  {
  int i;

  PORT0 = 0x0;
  for (i = 0 ; i < 20; i++)  {
    PORT0 = (PORT0 ^ 0x01);
    swatch(0.5);
  }
}

DEFINE BUTTON "Toggle P0.0", "toggle_IO_pin()"

Start debugging in simulation mode and drag the port into the Logic Analyzer. Open the Toolbox and click the button Toggle P0.0 to view the signal output:

Toggling PIN in Logic Analyzer

  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.