04.03.2013 Views

Basic Micro Studio Syntax Manual

Basic Micro Studio Syntax Manual

Basic Micro Studio Syntax Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

REVERSE<br />

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

reverse pin<br />

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

Supported<br />

• BA - Supported<br />

• BAN - Supported<br />

• BAP - Supported<br />

• BAP40 - Supported<br />

Commands<br />

Description<br />

REVERSE will switch the input/output direction of a pin. If the pin was an input it would reverse to an<br />

output. If the pin was an output it would reverse to an input. A pin’s state determines whether it can be<br />

read or set. To read a pin and determine if it has a high (1) or low (0) signal applied to it, the pin must<br />

be set to an input. A pin can only be set to high (1) or low (0) if the pin is in an output state.<br />

Schematic<br />

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

ohms.<br />

Example<br />

The program turns the LED on, using the High command which is an output command. Then the LED<br />

will turn off using the Reverse command which changes P0 from an output to an input. When P0 is an<br />

input the internal circuitry is disconnected and the pin can no longer supply the 5V need to illuminate<br />

the LED.<br />

Loop<br />

High p0<br />

Pause 500<br />

Reverse p0<br />

Pause 500<br />

Goto Loop<br />

P0<br />

R1<br />

390<br />

D1<br />

LED<br />

GND<br />

174

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

Saved successfully!

Ooh no, something went wrong!