BASIC Stamp Guide W. Durfee, University of Minnesota ver: oct-08 Available on-l
BASIC Stamp Guide W. Durfee, University of Minnesota ver: oct-08 Available on-line at www.me.umn.edu/courses/me2011/robot/ 1. Introduction Overview The BASIC Stamp is the simplest microcontroller to learn about and to use, even for the novice who has never programmed before. This guide is for students in ME 2011, or students anywhere who are confronting the Stamp for the first time. For advanced Stamp users, prowl the web; there are lots of resources. The BASIC Stamp is a microcontroller made by Parallax Inc (www.parallaxinc.com). The Stamp microcontroller chip comes in several flavors and Parallax also produces several packaged Stamp boards that incorporate the Stamp chip plus some peripherals. The Parallax web site has details on the complete Stamp product line. This guide covers the BASIC Stamp HomeWork Board (#28158), a product introduced by Parallax in 2002 exclusively for students and educators. With the HomeWork Board, you can write programs and create interface circuits to read switches and other sensors, and to control motors and lights with very little effort. Many of the pictures and drawings in this guide were taken directly from the documentation on the Parallax Web site, the place to turn if you need more information. Although we cover the HomeWork board, much of the material in this guide is appropriate for other Stamp models. The Stamp Interfacing section on the ME 2011 web site (www.me.umn.edu/courses/me2011) covers more on interfacing the Stamp to the real world. The HomeWork Board features a BASIC Stamp 2 controller module with a PIC16C57C- 20/SS microprocessor for running programs and a 24LC16B 2K EEPROM for storing programs. It is mounted on a board with a LM2936 5V, 50 mA voltage regulator that provides a voltage source to the chips, a female DB-9 serial port connector for talking to the host PC, power and ground connections, a breadboard area for adding your own circuits, and clips for attaching a 9V battery to power the board. The I/O pins on the Stamp have 220 ohm resistors attached which means it is practically impossible to damage the board through wiring mistakes. An important feature of the Stamp is that you can create a control program on the host PC, download it to the Stamp and it will run automatically. Remove the serial cable connection to the PC, and the program will still run from the top each time you push the reset button. Remove the battery and put the HomeWork board in a closet for six months. When you reconnect the battery, the last program you stored will run. This means that you connect the board to the host PC to develop and debug your program, but once that is done, you no longer need the PC to run the program. The BASIC Stamp code speed is 4000 instructions/sec which means 500- 600 PBASIC code lines every second. 1 Here is a picture of the HomeWork Board And here is a schematic of the HomeWork with a description of its parts taken from the Parallax HomeWork Board documentation. A. BASIC Stamp 2 Module. The BASIC Stamp is comprised of several components: PIC16C57- 20/SS- a Microchip 2K 8-bit microcontroller programmed with the BASIC Stamp “Interpreter” that runs the Parallax BASIC Stamp code like a mini operating system; the 24LC16B EEPROM - a Microchip 2KEEPROM (electrically erasable programmable read-only memory) with a user- modifiable read-only memory (ROM) that can be reprogrammed with your BASIC Stamp code; a 20 mHz resonator to provide an accurate clock source for the BASIC Stamp; 220 Ohm resistors across the I/O pins to provide current protection for mistake wiring; an LM2936 voltage regulator which provides 50 mA for the BASIC Stamp and your circuits powered from the breadboard’s Vdd 2 connection. B. DB-9 Female. The DB-9 port connects via serial cable to your PC’s serial port. This port is used to download programs to your BASIC Stamp and for the BASIC Stamp to send data back to the PC. C. Power and Ground Connections. Vdd is regulated 5V, Vin is 9V from the transistor battery, Vss is ground. D. Breadboard. Two areas of 5 column x 17 row breadboard project area. Connections are horizontal separated by the trough. Sets of five holes in each row are connected electrically. E. Power Button. Illuminated when the BASIC Stamp is running a program only. F. Reset Circuit. Reset the BASIC Stamp by pressing this button. G. Battery Tie-Downs. If using the HomeWork Board Through-Hole Version for projects involving high-vibration (on R/C airplanes, robots, etc.) a “zip-tie” can hold the battery firmly to the board if looped through these holes. H. Power Supply. Accepts a 9V battery. What you need for a working system 1. Stamp HomeWork Board 2. 9V battery 3. Serial port cable (standard, straight through; not a null modem cable) 4. Host PC running the Stamp application (stampw.exe) under some flavor of Windows. Stampw.exe is available from the Parallax web site. There are several flavors of the Stamp editor on the Parallax web site. For this guide, we'll assume you have the Basic Stamp 2 editor for Windows ver. 1.1, stampw.exe. Stampw.exe is not the newest version, but it works fine, is small in size and doesn't take long to download. Have a Mac? Go to the parallax.com web site and look for the “Software for Macintosh” section and download the Mac version of the Stamp editor. What to do if your computer has no serial port The Homework board connects to your PC through a serial port. Many modern PCs, particularly laptops, may not have a serial port but will have plenty of USB ports. To solve this problem, buy yourself a USB to Serial converter that creates a virtual serial port on the PC. There are many converter models and most (but not all) will run with the Stamp. Price does not matter and converters can be found for as low as $10. A $15 model from Parallax (PN 28030) is guaranteed to work with the Stamp but requires a separate USB A to mini B cable (Parallax PN 805-00006, $6.95.). For students in ME 2011, a usb serial adapter is included in the Robot Kit. Instructions for installing the adapter are in the Computer Connections section of the robot project web site 3 Getting started Plug the 9V battery into the battery terminals. WARNING: Check polarity before making the connection; otherwise you might blow out your board. The onboard LED (just above the reset button) may or may not light. This LED goes on when the Stamp is executing a program. If there was already a program burned into the Stamp from before the LED will be on, if there is no program it will be off. Warning: Do not put your board down on a conductive surface; you will short out the pins on the back! Connect the serial cable to the Stamp board, and the other end to the serial port connector on your PC. This connector is generally on the back, and will be the only connector that the female end of the cable will fit into. Start the stampw.exe program. In the editing window that comes up, enter the following one line program: debug "I'm alive" Your editor window will look something like this By selecting Run from the menu bar, then Run (or click on the right-facing triangle on the tool bar, or simply hit Ctrl+R) the program will be downloaded to the Stamp and run. 4 If all goes well, a Debug window will pop up with your message looking something like this Congratulations; you have created and run your first BASIC Stamp program! Push the Stamp reset button a few times and see what happens. Troubleshooting If you get a "BASIC Stamp II detected but not responding on COMn! Check power supply." or similar error message, or if the program runs but no message pops up, try the following: • Run the Stamp program again • Check that the battery is all the way in. • Check that the serial cable is secure at both ends. • Measure your battery voltage. If it's less than 7 volts while connected to the Stamp, get yourself a new battery. • Reboot your PC because sometimes the serial port can lock up • Try killing all programs on your PC except Stamp.exe (Ctrl+Alt+Delete, End all running tasks except Explorer, Systray and stampw) • Ask a friend for help If you get an error that's something like "Error: Expected xxxxxxx", you have a typo in your code. The code will be highlighted somewhere on or after the bug; it's up to you to search it out and correct. 5 If you want to check code syntax without a Stamp connected, use Ctrl+T (or Run > Check Syntax, or use the toolbar button). If you want to see how much memory your program takes up, use Ctrl+M (or Run > Memory Map, or use the toolbar button) Flashing an LED Light emitting diodes (LED's) are handy for checking out what the uploads/S4/ basic-stamp-guide.pdf
Documents similaires










-
52
-
0
-
0
Licence et utilisation
Gratuit pour un usage personnel Attribution requise- Détails
- Publié le Dec 21, 2021
- Catégorie Law / Droit
- Langue French
- Taille du fichier 0.2163MB