The Basic Stamp Computor Tutorial. Basic Stamp Computer. Tutorial. Created by Chip Randall. TJHSSTRev 1, March 1. Table of Contents. Purpose. of Tutorial. Part One- Using. Two- Controlling Pins With BASIC Commands, Binary System.
Parallax, Inc. • BASIC Stamp Programming Manual 1.8 • Page 69 BASIC Stamp I 1 BASIC Instructions WRITE location,data Store data in EEPROM location.
Part. Three- Addresses. Variables. Variable Commands. Part. Four- Execution Order Commands.
![Basic Stamp Programing Manual Basic Stamp Programing Manual](http://www.laureanno.com/RC/Mini-Flash-prog3.gif)
Part. Five- Reading High/Low Pin Conditions And Variable Resistances. Command Index. with Syntax. Purpose. Of this tutorial. The Basic Stamp computer is a product of. Parallax Incorporated.
Parallax, Inc. • BASIC Stamp Programming Manual 1.9 • Page 5 Introduction Thank you for purchasing a BASIC Stamp product. We’ve been making. Basic Stamp Computer Tutorial. The Stamp manual provided by Parallax is often confusing and advanced for the person with no programming. See The Basic Stamp.
The Stamp manual provided by Parallax is often confusing. This tutorial. attempts to give the beginning programmer a little more detailed information. P- Basic commands used with. Stamp. The Stamp is a microcontroller used to. It sends output signals to these devices and. It is necessary to have.
Downloads can be navigated by documents, code, software, design. BASIC Stamp Editor; Scribbler 2 (S2) Robot GUI; Product Title. Product ID. Download Title. For further information, refer to Basic Stamp® Programming Manual Version 2.0C and BASIC Stamp Syntax and Reference Manual Version 2.1. Software Interface. BASIC Stamp II Page 198 • BASIC Stamp Programming Manual 1.8 • Parallax, Inc. System Requirements To program the BASIC Stamp II, you’ll need the following computer. Prefix BASIC Stamp Programming Manual 2.0c • www.parallaxinc.com • Page 5 Thank you for purchasing the Parallax BASIC Stamp development system.
This tutorial will give example programs. Light Emitting Diodes (LED's)Resistors. Capacitors. Switches. Speakers. Thermistors. Photo Resistors. Transistors. The applications described in this tutorial. They were selected primarily to provide.
There are countless other applications. A wealth of information can be found at Parallax's web site, Parallaxinc. This web site also give information on joining the company sponsored chat. Part 1: Using the. Editor. The editor is a kind of word processor program which is supplied on. We download this program from the disk to. STAMP directory in our PC.
We use the editor to type our lines of programming. The editor also has a section which talks and listens to the Stamp using. The PBASIC commands are run line by line.
That is, the. computer does what the commands tell it to do one line after another and. The commands tell the stamp which operations. I/O (input/output) pins are to be involved. To enter the editor from the c: > prompt, type. Enter]. "STAMP" [Enter]. Once in the editor, programs can be saved and loaded. To save a file. hold down Alt and press S.
Then type a file name using 8 characters or. To load a file, hold down Alt and type L, then enter the name of. To exit the program, hold down alt and type Q.
Editor Function Keys. F1 Editor command help. Alt L List programs available. Alt R Run program.
Enter Enter information. Shift (hold) arrows highlights text with arrow direction. Escape Key Cancel highlighted text. Delete Key Delete highlighted text. Alt X Cut highlighted text and place in clipboard.
Alt C Copy highlighted text to clipboard. Alt V Paste clipboard into document. Alt P Get Scale of Potentiometer. NOTE: More detailed editor commands are in Stamp manual supplied. Comments may be added to program lines. Begin comments with an apostrophe. The computer will not read anything after an apostrophe until the next.
For example. pause 1. Controlling Pins and Time Topics covered. LOW, HIGH, DIRS, PINS, OUTPUT, REVERSE, TOGGLE, PAUSE, SLEEP, END, AND. The Basic Stamp has 8 I/O (input/output) pins which can be connected. These pins can be programmed. When the pins are in the output mode, they can be either.
Command. Function. Output 0 or Dir. 0=1 makes pin 0 an output pin. Input 7 or Dir. 7=0 makes pin 7 an input pin. Dirs=%0. 00. 01. 01. Dirs=1. 0 Sets all pins marked 0 to input and all pins.
Low 3 or Pin. 3=0 Makes pin 3 low or negative. High 4 or Pin. 4=1 Makes pin 4 high or positive. Pins=%1. 10. 01. 00. Makes all pins marked 1(high) and makes all. In this example, pins 0,3,6,& 7 are high. NOTE: The % signs means the number system in use is BINARY.
Pins. are numbered from right to left 7,6,5,4,3,2,1,0. The Conversion of Binary into Decimal.
A decimal number can be used to control the pins the same as a binary. Each pin has a decimal value as shown below. To convert a binary number to a decimal number, determine which pins. Above, the command PINS=%1. This could also have been.
PINS=2. 01 (1+8+6. Reverse. Reverse 6 (Reverses Input/Output state of Pin 6.). Toggle. Toggle 0 (Reverses the high/low state of pin 0 .). Pause. Pause 1. 00 (Pauses the program for 1.
Pause can be set from 1 to 6. Nap. Nap, period Nap enters a "Sleep" mode for a short period of time. Period can be any number from 0 to 7, each interval representing about. This reduces the computers power to 2. Sleep. Sleep seconds Sleep mode is similar to NAP, just longer.
Seconds. is a number from 1 to 6. This is from 1 second to a little more than. Sleep 1. 20 This tells the stamp to reduce power to 2. Sleep 3. 60. 0 'Go to sleep for 1 hour (6. End (End stops the line by line execution of the program. The. reset switch will have to be activated, or the program reloaded, or power.
Sound,(tone,duration.. Sound 0,(5. 0,1. 00) Sends a tone (5. The best tone range to use with small speakers is 3. Speakers. The duration can be from 0 to 2. Multiple tones may be programmed into. Sound 0,(7. 0,1. 00,0,1. Note that the first and third sound sets.
Using a tone. of 0 produces no sound or a pause in sound between the first and third. The following is an approximate music scale.
C 3. 5, C# 4. 0, D 4. D# 4. 9, E 5. 3, F 5. F #6. 0, G 6. 5, G# 6. A 7. 2, A #7. 5. Multiple commands can be put on the same line separated with a colon. Sound 0,(9. 0,1. 20): High 3: Pause 1. Part 3 - Branching. And Looping Topics Coverd: Branching - GOTO, GOSUB/RETURN, BRANCH,FOR..
NEXT, IF.. THEN, END. Address An ADDRESS is a label for a portion of a program. It. is useful when you wish to execute different portions of the program out. To go to an address. Goto. Goto address (To go to an address, use the command GOTO.). The following is a sample program with an address and the GOTO command.
Start: The colon tells the Stamp that this is an address. Don't use. P- basic command words as address titles. High 6 Makes pin 6 positive 5 volts. Pause 1. 20 Pauses the program for 1. Low 6 Makes pin 6 negative.
Pause 2. 0 Pauses the program for 2. Goto start Loops back up to the Start: and begins the program again.
Gosub.. Return. Gosub address. Return (sends program back to latest Gosub. The following program uses the Gosub/Return pair command. Gosub. directs the program to go to another address and then return to where it. Sound 0,(1. 00,2.
Variables. A variable is a location in the computer's memory where numbers can. There are three different types of variables - bits, bytes. There are 8 bits in each byte and 2 bytes in each word. High or low values, 0 or 1, can be stored in bits. Values up to 2. 55 can be stored in bytes. Very large values up to 6.
Bytes are used with most commands. To store a number in a byte, state. For example. to store the number 0 in a bit, you would type bit. To store the number. To store the number 1. Only bits 0 through 1.
There are 1. 4 bytes (b. W0 is composed of b.
B0 is composed of bit. Caution should be taken not to try to store data in variable already. For more detailed information about variables, see the stamp manual. RANDOM with DEBUGRandom wordvariable. This will generate a random number from 1 to 6. In the example. which follows, the random number will be stored in word W1 which is made.
The program then uses the lower byte (b. Sound command. Debug W1 'displays the value of w.
Debug B2 'B2 is lower byte of W1 (0 to 2. Sound 0, (b. 2, 1. If.. Then. Syntax: If, condition, Then, address. If the "condition" is true than the program will goto the address.
Otherwise. it will simply proceed down to the next program line. Condition can be any logical statement, such as b. Operators allowed are.
Greater Than. > = Greater than or equal to. Less than or equal to.
Not equal to. The "address" part must be an address in the program. In this program example we use the Annoy program from the RANDOM introduction. Debug W1 'displays the value of w. Debug B2 'B2 is lower byte of W1 (0 t. If b. 2< 3. 0 or b.
Then ANNOY. Sound (b. For- Next. For variable = start To end Step increment. The For- Next command provides a method of repeating commands for a specified.
The following program will blink an LED attached to pin. For b. 2= 0 to 5 (Note that the 0 counts for one time.). The following program will blink the LED 4 times. For b. 2 = 2 to 8 step 2. Note that the program increments through in steps of 2. Unless the step. is written, the program will increment through plus one step or one number.
The following program will blink the seven LED's in sequence. For b. 2 = 1 to 7 'step 1. For b. 2 = 8 to 2 step - 2 'increments in steps of - 2. Note that this program used the For..
Next to count the number of times. And, it also used the value of b. Branch. Branch offset variable. This command allows us to send the program operation to an address selected. Branch b. 2, (Noise, Blink, Flash) b. OFFSET. Sound 0,(5. For b. 3=0 to 8 step 2.
When the value of b. NOISE. subroutine. When the value of b. BLINK. subroutine. PART 4- Execution. Order Commands. Let.
The let command allows the programmer to assign numerical values. Let b. 4=1. 20 Assigns the value of 1. Let b. 6=3 + 7 Assigns the value of 1. Below is a list of the math operator symbols. MIN keep variable greater than or equal to value.
MAX keep variable less than or equal to value. Logical AND. ^ Logical XOR (Exclusive or). Logical AND NOT. |/ Logical OR NOT. Logical XOR NOT. let b. The Stamp performs mathematical operations strictly from left to right. However, the Stamp returns a result.
Remember that values up to 2. BYTES but higher values. Lookup. This command asks the program to lookup a value specified by an offset. Once it has "looked up" the value, that value. Lookup b. 2, (5. 0,1. If the value of b. If b. 2 is 0 then 5.
Assigns one of the six values. It is important to remember that the first value is zero, not 1, therefore. Lookdown. Lookdown variable, (value.
Like the Lookup command, the Lookdown command checks the. If variable matches one of the. If b. 2 were equal to 8, then it store the value of 2 in b. If b. 2 were. 7 then it would assign the value of 3 to b. If the offset value of b. The program would just proceed to the next command line.
Once again, remember that the position value numbers start with zero, not. Reading High/Low Pin Conditions And Variable Resistances. The Stamp can check one or all the pins to see if there is a positive.