04.03.2013 Views

Basic Micro Studio Syntax Manual

Basic Micro Studio Syntax Manual

Basic Micro Studio Syntax Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

TOGGLE<br />

<strong>Syntax</strong><br />

toggle pin<br />

• Pin - is any expression, constant or variable that specifi es an I/O pin to use.<br />

Supported<br />

• BA - Supported<br />

• BAN - Supported<br />

• BAP - Supported<br />

• BAP40 - Supported<br />

Commands<br />

Description<br />

TOGGLE confi gures a pin as an output and toggles it's state from low (0) to high (1) or high (1) to low<br />

(0). The TOGGLE command is not like the REVERSE command since TOGGLE only deals with the<br />

output state of the pin low or high.<br />

Notes<br />

1. All pins on power up are inputs by default with a default output state of low if made outputs.<br />

Schematic<br />

Connect a LED as shown below. You can substitute the resistor for anything from 330 ohms to 470<br />

ohms.<br />

Example<br />

The following program demonstrates another way to blink an LED attached to pin 0. The TOGGLE<br />

command changes the state of the pin from low as defi ned by LOW P0 to a high since it “toggles” the<br />

pin state.<br />

;Wire an LED to P0<br />

Low p0<br />

Main<br />

Toggle p0<br />

Pause 500<br />

Goto main<br />

P0<br />

R1<br />

390<br />

D1<br />

LED<br />

GND<br />

200

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!