Task+1

Task 1


 * 1) Assign Tasks on Home Page
 * 2) Install Software
 * 3) Make Note of Parts
 * 4) Become familiar with the book

Page 21 Testing for Communication Page 22 Activity #4 Page 35 Activity #7

The Summary of Chapter 1 can be found on page 37

Programming:

How many of you already know how to write a computer ** program ** ? If you’ve done it before, then the first part of this section may be review. But if you’re a “newbie”, don’t worry! It’s really not that hard. A computer program is nothing more than a list of instructions that a computer (or in our case, a microcontroller) executes. We create a program for the microcontroller by typing it into a PC (utilizing the keyboard & monitor), then we send this “code” through the programming cable, to the microcontroller. This program (or list of instructions) then runs or “executes” inside the BASIC Stamp. If we’ve written the program correctly, it will do what we want it to do. However, if we make a mistake, then the device won’t work (or works poorly), and we need to “debug it”. Debugging can be one of the most hair-pulling experiences in the entire process, therefore, the more careful you are in creating the program, theoretically the easier it’ll be to debug. A software “** bug ** ” is an error in your program. Therefore, debugging is the art of “bug” removal! PBASIC for the BASIC Stamp has a bunch of // commands // to choose from; 36 to be exact. A complete listing & description on each of these commands can be obtained from the Basic Stamp Manual Version 1.9, but each command used in these lessons is further described in Appendix B, PBASIC Quick Reference. For the purposes of this experiment we’re going to look at only four commands. These are: ** OUTPUT, PAUSE, GOTO, & OUT **. As mentioned above, a program is a list of instructions that are executed in a sequence determined by the structure of the program itself. Therefore, as we write a program, it is very important to keep in mind the sequence of execution that we desire. For example, if we want to buy a soda from a vending machine, our brain executes a list of commands to accomplish this. Perhaps something like… 1. Insert $1.00 into slot. 2. Wait for green light to come on. 3. Push button for soda type. 4. Watch soda fall into tray. 5. Pick up soda from tray. 6. Open soda. 7. Drink soda. 8. Burp. Now, that seems pretty straightforward, but only because we’ve done it before. If however, your brain was sending out the following “program”: 1. Push button for soda type. 2. Open soda. 3. Insert $1.00 into slot. 4. Pick up soda from tray. 5. Burp 6. Drink soda. 7. Wait for green light to come on. 8. Watch soda fall into tray. Not much would happen. All the proper commands are there, but they’re in the // wrong order //. Once you’ve pushed the button for “soda type” (step #1), your brain (program) would “hang” or stall because it can’t execute “open soda”, because there’s no soda to open!