beautypg.com

Optional - to learn about programming – Elenco XP&trade User Manual

Page 34

background image

-33-

OPTIONAL - TO LEARN ABOUT PROGRAMMING

You can edit the program to change
parameters or commands if desired. The
editing procedure is similar to other Windows

®

word processors. You may also type in a
completely new program. To save programs
you have created or modified, use

Save As

under

File

menu.

Only valid programs (without errors) may be
downloaded, or a downloading error will
result. You can check for errors by clicking the

Syntax

box, and then clicking

Program

.

Syntax

also tells you how much memory the

program uses; programs must be of 256 bytes
of memory or less. All Snap Circuits

®

XP

TM

programs have already been checked for
errors.

Explanations for all the microcontroller
commands, and some basic information about
programming, can be found under the Help menu
at Snap Circuits

®

XP

TM

.

Use this file to look up a command you want to
learn about. If you later want to write your own
programs, you’ll need to use this often. Part C - To
Go Further (page 59) has other useful information.

The PICAXE

®

Manual (Parts 1, 2, and 3) has more

detailed explanations of the PICAXE

®

commands,

and other information about PICAXE

®

products,

however much of this information is not applicable
to Snap Circuits

®

XP

TM

and some is very technical.

The Snap Circuits

®

XP

TM

help file is customized to

your product.

Here is how the program works:

high

2

- this tells the microcontroller to put

an electrical voltage at out put 2 (where
the red LED is connected). This voltage
will light the LED.

pause

1000

- this tells the microcontroller

to pause for 1000 milliseconds, or 1
second, before performing the next
instruction.

low

2

- this tells the microcontroller to turn

off or remove any voltage at output 2. This
will turn off the red LED.

goto

main - this tells the microcontroller

to execute the instructions next to “main:”,
which here means repeating the
instruction set. This causes the LED to
turn on and off, blinking continuously.

Information after an apostrophe (‘) symbol is

Comments

. Comments are a description of

what the program is doing, to help you
understand and remember it. Comments are
ignored by the microcontroller.