BASIC Stamp Programming Manual 2.0C · · Page 1 Contents
Total Page:16
File Type:pdf, Size:1020Kb
BASIC Stamp Ò Programming Manual Version 2.0c Warranty Parallax warrants its products against defects in materials and workmanship for a period of 90 days. If you discover a defect, Parallax will, at its option, repair, replace, or refund the purchase price. Simply call our sales department for an RMA number, write it on the label and return the product with a description of the problem. We will return your product, or its replacement, using the same shipping method used to ship the product to Parallax (for instance, if you ship your product via overnight express, we will do the same). This warranty does not apply if the product has been modified or damaged by accident, abuse, or misuse. 14-Day Money-Back Guarantee If, within 14 days of having received your product, you find that it does not suit your needs, you may return it for a refund. Parallax will refund the purchase price of the product, excluding shipping/handling costs. This does not apply if the product has been altered or damaged. Copyrights and Trademarks Copyright © 2000 by Parallax, Inc. All rights reserved. PBASIC is a trademark and BASIC Stamp is a registered trademark or Parallax, Inc. PIC is a registered trademark of Microchip Technology, Inc. Windows is a registered trademark of Microsoft Corporation. 1-wire is a registered trademark of Dallas Semiconductor. Other brand and product names are trademarks or registered trademarks of their respective holders. Disclaimer of Liability Parallax, Inc. is not responsible for special, incidental, or consequential damages resulting from any breach of warranty, or under any legal theory, including lost profits, downtime, goodwill, damage to or replacement of equipment or property, and any costs of recovering, reprogramming, or reproducing any data stored in or used with Parallax products. Internet Access We maintain Internet systems for your convenience. These may be used to obtain software, communicate with members of Parallax, and communicate with other customers. Access information is shown below: Web: http://www.parallaxinc.com http://www.stampsinclass.com General e-mail: [email protected] Tech. e-mail: [email protected] Internet BASIC Stamp Discussion List We maintain a BASIC Stamp discussion list for people interested in BASIC Stamps. Many people subscribe to the list, and all questions and answers to the list are distributed to all subscribers. It’s a fun, fast, and free way to discuss BASIC Stamp issues. To subscribe to the BASIC Stamps list, visit the Tech Support section of the Parallax, Inc website. This manual is valid with the following software and firmware versions: BASIC Stamp 1: BASIC Stamp 2sx: STAMP.EXE software version 2.1 STAMP2SX.EXE software version 1.0 Firmware version 1.4 STAMPW.EXE software version 1.096 Firmware version 1.0 BASIC Stamp 2: STAMP2.EXE software version 1.1 BASIC Stamp 2p: STAMPW.EXE software version 1.096 STAMP2P.EXE software version 1.6 Firmware version 1.0 STAMPW.EXE software version 1.098 Firmware version 1.1 BASIC Stamp 2e: STAMP2E.EXE software version 1.0 STAMPW.EXE software version 1.096 Firmware version 1.0 The information herein will usually apply to newer versions but may not apply to older versions. New software can be obtained free on our ftp and web site (ftp.parallaxinc.com, www.parallaxinc.com). If you have any questions about what you need to upgrade your product, please contact Parallax. Contents PREFIX ........................................................................................................5 INTRODUCTION TO THE BASIC STAMP.........................................................7 BASIC STAMP 1 HARDWARE .........................................................................................8 BASIC STAMP 2 HARDWARE .......................................................................................10 BASIC STAMP 2E HARDWARE .....................................................................................12 BASIC STAMP 2SX HARDWARE...................................................................................14 BASIC STAMP 2P HARDWARE .....................................................................................16 DEVELOPMENT BOARDS ...............................................................................................18 BASIC Stamp 1 Carrier Board ..............................................................................18 BASIC Stamp 2 Carrier Board ..............................................................................19 BASIC Stamp Super Carrier Board......................................................................20 Board of Education .................................................................................................22 BASIC Stamp Activity Board .................................................................................23 GUIDELINES AND PRECAUTIONS...................................................................................25 QUICK START GUIDE.................................................................................29 USING THE BASIC STAMP EDITOR .............................................................33 BASIC STAMP WINDOWS EDITOR ...............................................................................34 BASIC STAMP DOS EDITOR .......................................................................................41 BASIC STAMP ARCHITECTURE...................................................................45 RAM ORGANIZATION (BS1) .........................................................................................45 RAM ORGANIZATION (BS2, BS2E, BS2SX, BS2P) ...................................................46 DEFINING AND USING VARIABLES.................................................................................48 The Rules of Symbol Names ................................................................................49 Defining Array Variables ........................................................................................51 Aliases and Variable Modifiers..............................................................................53 CONSTANTS AND COMPILE-TIME EXPRESSIONS .........................................................56 NUMBER REPRESENTATIONS .......................................................................................59 ORDER OF OPERATIONS...............................................................................................60 INTEGER MATH RULES..................................................................................................62 UNARY OPERATORS......................................................................................................63 Absolute Value (ABS).............................................................................................64 Cosine (COS) ..........................................................................................................64 Decoder (DCD)........................................................................................................64 BASIC Stamp Programming Manual 2.0c · www.parallaxinc.com · Page 1 Contents Inverse (~)................................................................................................................64 Negative (-)..............................................................................................................64 Encoder (NCD)........................................................................................................65 Sine (SIN) ................................................................................................................65 Square Root (SQR) ................................................................................................66 BINARY OPERATORS.....................................................................................................66 Add (+)......................................................................................................................67 Subtract (-)...............................................................................................................67 Multiply (*)................................................................................................................67 Multiply High (**) .....................................................................................................68 Multiply Middle (*/) ..................................................................................................68 Divide (/)...................................................................................................................69 Modulus (//)..............................................................................................................70 Minimum (MIN)........................................................................................................70 Maximum (MAX) .....................................................................................................71 Digit (DIG)................................................................................................................72 Shift Left (<<)...........................................................................................................72 Shift Right (>>)........................................................................................................72 Reverse (REV) ........................................................................................................73 And (&) .....................................................................................................................73