BASIC Stamp Ò Programming Manual

1y ago
3 Views
2 Downloads
1.93 MB
353 Pages
Last View : 1m ago
Last Download : 3m ago
Upload by : Elise Ammons
Transcription

BASIC Stamp Programming ManualVersion 2.0c

WarrantyParallax 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 RMAnumber, write it on the label and return the product with a description of the problem. We will return your product, or itsreplacement, using the same shipping method used to ship the product to Parallax (for instance, if you ship your product viaovernight 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 GuaranteeIf, 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 theproduct has been altered or damaged.Copyrights and TrademarksCopyright 2000 by Parallax, Inc. All rights reserved. PBASIC is a trademark and BASIC Stamp is a registered trademark orParallax, Inc. PIC is a registered trademark of Microchip Technology, Inc. Windows is a registered trademark of MicrosoftCorporation. 1-wire is a registered trademark of Dallas Semiconductor. Other brand and product names are trademarks orregistered trademarks of their respective holders.Disclaimer of LiabilityParallax, Inc. is not responsible for special, incidental, or consequential damages resulting from any breach of warranty, orunder any legal theory, including lost profits, downtime, goodwill, damage to or replacement of equipment or property, andany costs of recovering, reprogramming, or reproducing any data stored in or used with Parallax products.Internet AccessWe maintain Internet systems for your convenience. These may be used to obtain software, communicate with members ofParallax, and communicate with other customers. Access information is shown below:Web:General e-mail:Tech. nc.comInternet BASIC Stamp Discussion ListWe maintain a BASIC Stamp discussion list for people interested in BASIC Stamps. Many people subscribe to the list, and allquestions and answers to the list are distributed to all subscribers. It’s a fun, fast, and free way to discuss BASIC Stampissues. 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:STAMP.EXE software version 2.1Firmware version 1.4BASIC Stamp 2:STAMP2.EXE software version 1.1STAMPW.EXE software version 1.096Firmware version 1.0BASIC Stamp 2sx:STAMP2SX.EXE software version 1.0STAMPW.EXE software version 1.096Firmware version 1.0BASIC Stamp 2p:STAMP2P.EXE software version 1.6STAMPW.EXE software version 1.098Firmware version 1.1BASIC Stamp 2e:STAMP2E.EXE software version 1.0STAMPW.EXE software version 1.096Firmware version 1.0The information herein will usually apply to newer versions but may not apply to older versions. New software can beobtained free on our ftp and web site (ftp.parallaxinc.com, www.parallaxinc.com). If you have any questions about whatyou need to upgrade your product, please contact Parallax.

ContentsPREFIX .5INTRODUCTION TO THE BASIC STAMP.7BASIC STAMP 1 HARDWARE .8BASIC STAMP 2 HARDWARE .10BASIC STAMP 2E HARDWARE .12BASIC STAMP 2SX HARDWARE .14BASIC STAMP 2P HARDWARE .16DEVELOPMENT BOARDS .18BASIC Stamp 1 Carrier Board .18BASIC Stamp 2 Carrier Board .19BASIC Stamp Super Carrier Board .20Board of Education .22BASIC Stamp Activity Board .23GUIDELINES AND PRECAUTIONS.25QUICK START GUIDE.29USING THE BASIC STAMP EDITOR .33BASIC STAMP WINDOWS EDITOR .34BASIC STAMP DOS EDITOR .41BASIC STAMP ARCHITECTURE.45RAM ORGANIZATION (BS1) .45RAM ORGANIZATION (BS2, BS2E, BS2SX, BS2P) .46DEFINING AND USING VARIABLES.48The Rules of Symbol Names .49Defining Array Variables .51Aliases and Variable Modifiers.53CONSTANTS AND COMPILE-TIME EXPRESSIONS .56NUMBER REPRESENTATIONS .59ORDER OF OPERATIONS .60INTEGER MATH RULES .62UNARY OPERATORS.63Absolute Value (ABS).64Cosine (COS) .64Decoder (DCD).64BASIC Stamp Programming Manual 2.0c www.parallaxinc.com Page 1

ContentsInverse ( ) .64Negative (-) .64Encoder (NCD).65Sine (SIN) .65Square Root (SQR) .66BINARY OPERATORS .66Add ( ).67Subtract (-) .67Multiply (*) .67Multiply High (**) .68Multiply Middle (*/) .68Divide (/) .69Modulus (//) .70Minimum (MIN).70Maximum (MAX) .71Digit (DIG) .72Shift Left ( ) .72Shift Right ( ) .72Reverse (REV) .73And (&) .73Or ( ).73Xor ( ) .74And Not (&/) .75Or Not ( /) .75Xor Not ( /).75BASIC STAMP COMMAND REFERENCE .77AUXIO.81BRANCH.83BUTTON .85COUNT .89DATA.91DEBUG .97DTMFOUT.107EEPROM.111END.115FOR NEXT .117FREQOUT.123GET.127Page 2 BASIC Stamp Programming Manual 2.0b www.parallaxinc.com

ContentsGOSUB .129GOTO.133HIGH .135I2CIN .137I2COUT .143IF THEN.149INPUT .155IOTERM .157LCDCMD.159LCDIN .167LCDOUT .171LOOKDOWN.177LOOKUP .183LOW .187MAINIO .189NAP.191OUTPUT .195OWIN .197OWOUT .205PAUSE .213POLLIN .215POLLMODE .219POLLOUT .225POLLRUN .231POLLWAIT .235POT.239PULSIN .241PULSOUT .243PUT .245PWM .247RANDOM .251RCTIME .255READ .261RETURN .265REVERSE .267RUN .269SERIN .273SEROUT .293SHIFTIN .309SHIFTOUT .313SLEEP.317SOUND .319BASIC Stamp Programming Manual 2.0c www.parallaxinc.com Page 3

ContentsSTOP .321STOP .323TOGGLE .327WRITE.329XOUT .333APPENDIX A: ASCII CHART .337APPENDIX B: RESERVED WORDS .339APPENDIX C: CONVERSION FORMATTERS .341Page 4 BASIC Stamp Programming Manual 2.0b www.parallaxinc.com

PrefixThank you for purchasing the Parallax BASIC Stamp developmentsystem. We have done our best to produce a full-featured, yet easy to usedevelopment system for the BASIC Stamp microcontrollers. We hope youwill find this system as enjoyable to use as we do.This manual is written for the latest available BASIC Stamp modules andsoftware as of November 2000. As the product-line evolves newinformation may become available. It is always recommended to visit theParallax, Inc. web site, www.parallaxinc.com, for the latest information.This manual is intended to be a complete reference manual to thearchitecture and command structure of the BASIC Stamps. This manual isnot meant to teach programming or electrical design; though a person canlearn a lot by paying close attention to the details in this book. If you havenever programmed in the BASIC language or are unfamiliar withelectronics, it would be best to locate one or more of the following booksfor further information:1.2.3.4.5.6.7.Programming and Customizing the BASIC Stamp ComputerScott Edwards, TAB Books ISBN: 0-07-913684-2Microcontroller Projects with BASIC StampsAl Williams, R&D Books ISBN: 0-87930-587-8The Microcontroller Application CookbookMatt Gilliland, Woodglen Press ISBN: 0-615-11552-7What's A MicrocontrollerFree on Parallax CD (Documentation - Educational Curriculumsection) and web site (Downloads section), or for purchase in printBASIC Analog and DigitalFree on Parallax CD (Documentation - Educational Curriculumsection) and web site (Downloads section), or for purchase in printEarth MeasurementsFree on Parallax CD (Documentation - Educational Curriculumsection) and web site (Downloads section), or for purchase in printRoboticsFree on Parallax CD (Documentation - Educational Curriculumsection) and web site (Downloads section), or for purchase in printIn addition, there are hundreds of great examples available on the ParallaxCD and web site (www.parallaxinc.com). Also, Nut & Volts Magazine(www.nutsvolts.com / 1-800-783-4624) is a national electronic hobbyist'sBASIC Stamp Programming Manual 2.0c www.parallaxinc.com Page 5

Prefixmagazine that features monthly articles featuring the BASIC Stamps. Thisis an excellent resource for beginners and experts alike! For a sample of theBASIC Stamp articles, visit their web site.Packing ListThe BASIC Stamps are available in many different forms. You may havereceived them in a Starter Kit in a special limited-time package orindividually. The packing list below describes the general list of items thatwould be included in a BASIC Stamp Starter Kit at the time of this writing:BASIC Stamp Starter Kit (1) BASIC Stamp Module (Rev. D, BS1-IC, OEMBS1, BS2-IC,OEMBS2, BS2e-IC, BS2sx-IC or BS2p-IC)(1) BASIC Stamp development software (on CD in Software section)(1) BASIC Stamp manual (this manual)(1) BASIC Stamp development board (Stamp 1 Carrier Board, Stamp2 Carrier Board, Super Carrier Board, BASIC Stamp ActivityBoard or Board or Education)(1) Set of jumper wires (only included with Board of Education)(1) 9-pin serial cableIf any items are missing, please let us know.Page 6 BASIC Stamp Programming Manual 2.0b www.parallaxinc.com

1: Introduction to the BASIC StampsWelcome to the wonderful world of BASIC Stamp microntrollers. BASICStamp microcontrollers have been in use by engineers and hobbyists sincewe first introduced them in 1992. As of July 2000, Parallax customers haveput more than 200,000 BASIC Stamp modules into use. Over this eightyear period, the BASIC Stamp line of controllers has evolved into fivemodels and many physical package types, explained below.General Operation TheoryBASIC Stamps are microcontrollers (tiny computers) that are designed foruse in a wide array of applications. Many projects that require anembedded system with some level of intelligence can use a BASIC Stampmodule as the controller.Each BASIC Stamp comes with a BASIC Interpreter chip, internal memory(RAM and EEPROM), a 5-volt regulator, a number of general-purpose I/Opins (TTL-level, 0-5 volts), and a set of built-in commands for math andI/O pin operations. BASIC Stamps are capable of running a few thousandinstructions per second and are programmed with a simplified, butcustomized form of the BASIC programming language, called PBASIC.PBASIC LanguageWe developed PBASIC specifically for the BASIC Stamps as a simple, easyto learn language that is also well suited for this architecture. It includesmany of the instructions featured in other forms of BASIC (GOTO,FOR.NEXT, IF.THEN) as well as some specialized instructions (SERIN,PWM, BUTTON, COUNT and DTMFOUT). This manual includes anextensive section devoted to each of the available instructions.HardwareAt the time of this writing, there are currently five models of the BASICStamp; the BASIC Stamp 1, BASIC Stamp 2, BASIC Stamp 2e, BASICStamp 2sx and BASIC Stamp 2p. The diagrams below detail the variouspackage types and part numbers of these modules.BASIC Stamp Programming Manual 2.0c www.parallaxinc.com Page 7

Introduction to the BASIC StampsFigure 1.1: BASIC Stamp 1 Rev. D(27100) 5VP7P6P5P4P3P2P1P0Vss 1993TM REV D VssVss 1.5“ (38 mm)VinBasic Stamp 5V.1“ (2.54 mm).5“ (13 mm).5“ (13 mm)BASIC Stamp 1.1“ (2.54 mm)2.5“ (63.5 mm).4“ (10 mm)BS1-IC1413Figure 1.2: BASIC Stamp 1 (Rev.B) 1VINVSS.19“ (4.8 mm)1.41“ (36 mm).1“ (2.54 mm)1.4“ (36 mm)XTALOEMBASIC Stamp 1(c) 199910.1“ (2.54 mm) 1C1 U3RN1VinVssPCOPCIVddRESP0P1P2P3P4P5P6P710.25“ (6 mm)11.4“ (36 mm)1Figure 1.3: OEM BASIC Stamp 1(Rev. A) (27295 or 27296)Rev A0.1“ (2.54 mm)Page 8 BASIC Stamp Programming Manual 2.0b www.parallaxinc.com

1: Introduction to the BASIC StampsThe BASIC Stamp 1 is available in the above three physical packages. TheBASIC Stamp 1 Rev. D (simply called the Rev. D), see Figure 1.1, includesprototyping area suitable for soldering electronic components. The BS1-IC(Figure 1.2) uses surface mount components to fit in a small 14-pin SIPpackage. The OEMBS1 (Figure 1.3) features an easier-to-trace layoutmeant to aid customers who wish to integrate the BASIC Stamp 1 circuitdirectly into their design (as a lower-cost solution). The OEMBS1 isavailable in either an assembled form or a kit form. All three packages arefunctionally equivalent with the exception that the Rev. D does not havean available reset pin.Table 1.1: BASIC Stamp 1 4P0-P7DescriptionUnregulated power in: accepts 5.5 - 15 VDC (6-40 VDC onBS1-IC rev. b), which is then internally regulated to 5 volts. Maybe left unconnected if 5 volts is applied to the VDD ( 5V) pin.System ground: connects to PC parallel port pin 25 (GND) forprogramming.PC Out: connects to PC parallel port pin 11 (BUSY) forprogramming.PC In: connects to PC parallel port pin 2 (D0) for programming.5-volt DC input/output: (Also called 5V) if an unregulated voltageis applied to the VIN pin, then this pin will output 5 volts. If novoltage is applied to the VIN pin, then a regulated voltagebetween 4.5V and 5.5V should be applied to this pin.Reset input/output: goes low when power supply is less thanapproximately 4.2 volts, causing the BASIC Stamp to reset. Canbe driven low to force a reset. This pin is internally pulled highand may be left disconnected if not needed. Do not drive high.General-purpose I/O pins: each can sink 25 mA and source 20mA. However, the total of all pins should not exceed 50 mA (sink)and 40 mA (source).See the "BASIC Stamp Programming Connections" section, below, formore information on the required programming connections between thePC and the BASIC Stamp.BASIC Stamp Programming Manual 2.0c www.parallaxinc.com Page 9

Introduction to the BASIC StampsBASIC Stamp 3817P12P4916P11P51015P10P61114P9P71213P8.1“ (2.54 mm)ATNVSSFigure 1.4: BASIC Stamp 2(Rev. E) (BS2-IC)1.2“ (31 mm)SOUTSINBS2-IC.62“ (16 mm)2.0“ (51 mm) Figure 1.5: OEM BASIC Stamp 2(Rev. A) (27290 or 27291)OEM BASIC Stamp 2(c) 1999Rev AQ32.0“ (51 3P14P15RESP0VddVssVinC20.25“ (6 mm)0.25“ (6 mm)U30.1“ (2.54 mm)The BASIC Stamp 2 is available in the above two physical packages. TheBS2-IC (Figure 1.4) uses surface mount components to fit in a small 24-pinDIP package. The OEMBS2 (Figure 1.5) features an easier-to-trace layoutmeant to aid customers who wish to integrate the BASIC Stamp 2 circuitdirectly into their design (as a lower-cost solution). The OEMBS2 isavailable in either an assembled form or a kit form. Both packages arefunctionally equivalent.Page 10 BASIC Stamp Programming Manual 2.0b www.parallaxinc.com

1: Introduction to the BASIC StampsTable 1.2: BASIC Stamp 2 21VDD22RES23VSS24VINDescriptionSerial Out: connects to PC serial port RX pin (DB9 pin 2 / DB25pin 3) for programming.Serial In: connects to PC serial port TX pin (DB9 pin 3 / DB25 pin2) for programming.Attention: connects to PC serial port DTR pin (DB9 pin 4 / DB25pin 20) for programming.System ground: (same as pin 23) connects to PC serial port GNDpin (DB9 pin 5 / DB25 pin 7) for programming.General-purpose I/O pins: each can sink 25 mA and source 20mA. However, the total of all pins should not exceed 50 mA (sink)and 40 mA (source) if using the internal 5-volt regulator. The totalper 8-pin groups (P0 – P7 or P8 – 15) should not exceed 50 mA(sink) and 40 mA (source) if using an external 5-volt regulator.5-volt DC input/output: if an unregulated voltage is applied to theVIN pin, then this pin will output 5 volts. If no voltage is applied tothe VIN pin, then a regulated voltage between 4.5V and 5.5Vshould be applied to this pin.Reset input/output: goes low when power supply is less thanapproximately 4.2 volts, causing the BASIC Stamp to reset. Canbe driven low to force a reset. This pin is internally pulled highand may be left disconnected if not needed. Do not drive high.System ground: (same as pin 4) connects to power supply’sground (GND) terminal.Unregulated power in: accepts 5.5 - 15 VDC (6-40 VDC on BS2IC rev. e), which is then internally regulated to 5 volts. May be leftunconnected if 5 volts is applied to the VDD ( 5V) pin.See the "BASIC Stamp Programming Connections" section, below, formore information on the required programming connections between thePC and the BASIC Stamp.BASIC Stamp Programming Manual 2.0c www.parallaxinc.com Page 11

Introduction to the BASIC StampsBASIC Stamp 2e1223VINVSS24BS2e 7P12P4916P11P51015P10P61114P9P71213P8Rev AFigure 1.6: BASIC Stamp 2e(Rev. A) (BS2e-IC)1.2“ (31 mm)1.1“ (2.54 mm)SOUTSINBS2e-IC.62“ (16 mm)2.0“ (51 mm)Figure 1.7: OEM BASIC Stamp 2e(Rev A) (27293) (c) 2000C1Rev AQ32.0“ (51 P15RESP0VddVssVinC2 C30.25“ (6 mm)0.25“ (6 mm)Q20.1“ (2.54 mm)The BASIC Stamp 2e is available in the above two physical packages. TheBS2e-IC (Figure 1.6) uses surface mount components to fit in a small 24pin DIP package. The OEMBS2e (Figure 1.7) features an easier-to-tracelayout meant to aid customers who wish to integrate the BASIC Stamp 2ecircuit directly into their design (as a lower-cost solution). The OEMBS2eis available in assembled form only.Page 12 BASIC Stamp Programming Manual 2.0b www.parallaxinc.com

1: Introduction to the BASIC StampsTable 1.3: BASIC Stamp 2e 21VDD22RES23VSS24VINDescriptionSerial Out: connects to PC serial port RX pin (DB9 pin

BASIC Stamps are microcontrollers (tiny computers) that are designed for use in a wide array of applications. Many projects that require an embedded system with some level of intelligence can use a BASIC Stamp module as the controller. Each BASIC Stamp comes with a BASIC Interpreter chip, internal memory

Related Documents:

From Land to Sea stamp set (A card 1) Fresh Fruit stamp set (A card 1, B card 1, C card 1) Sprinkles of Life stamp set (A card 2) Balloon Builders stamp set (B card 1, C card 1) Thankful Thoughts stamp set (B card 2) No Bones About It stamp set (C cards 3 & 4, D card 2) Tin of Card stamp set (C card 4) Stylized Birthday

marks" 2 times in Real Red - stamp off on scrap paper first to make the color lighter (for placement, set card inside the Balmy Blue card base) Stamp Basic White card inside using Real Red (stamp off 1st), Garden Green, Soft Suede o Note - I cut my "happy birthday" stamp into 2 stamps so that I could use JUST the "birthday".

Acura of Orange Park recommends service every 5,000 miles. Please refer to your vehicle owner's manual for details on maintenance schedules. When you take . Dealer Stamp Mileage Date 116,250 MILES120,000 123,750 MILES Dealer Stamp Mileage Date Dealer Stamp Mileage Date 127,500 MILES131,250 135,000 MILES Dealer Stamp Mileage

with Corel Draw A few guidelines are needed in order to ensure further production when creating or adapting a stamp master with Corel Draw. It is essential that you first decide whether you are creating a new stamp or adapting an existing stamp master. If you are creating a new stamp, the correct set-up is important. If you are adapting an

CHECK LIST FOR AREA OFFICES INCHARGE OF BOBCARD LTD. . authorised by all the partners with stamp on all pages. Sign of ALL partners/ or Mandate authorised by . 4. Stamp Paper/Franking/Adhesive stamp in case of applicable States only/ e-stamping a) Stamp paper to be purchased in the name of BOBCARDS LTD./ME only. .

the bird for the inside of card. Stamp banner sentiment at the top of the inside of card. In Gorgeous Grape, stamp hearts randomly on both panels of the front of the card. Stamp hearts in the upper left corner of the front. Stamp a balloon in the bird’s beak on the inside.

stamp set bb 7 153301 cute fruit photopolymer stamp set 16.00 . paper bb 5 153184 flowers for every season cards & more 10.00 40% 6.00 . bundle ac 100 154137 playing with patterns suite collection 82.50 stamp set

hardware IP re-use and consistency accross product families and higher level programming language makes the development job far more convenient when dealing with the STM32 families. HIGH-PERFORMANCE HIGH DEGREE OF INTEGRATION AND RICH CONNECTIVITY STM32H7: highest performance STM32 MCUs with advanced features including DSP and FPU instructions based on Cortex -M7 with 1 to 2 Mbytes of .