30064 Parallax Inc, 30064 Datasheet - Page 7
![STAMP PLC](/photos/6/75/67556/mfg_30064_sml.jpg)
30064
Manufacturer Part Number
30064
Description
STAMP PLC
Manufacturer
Parallax Inc
Datasheet
1.30064.pdf
(27 pages)
Specifications of 30064
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
For Use With/related Products
BASIC Stamp®
Module/board Type
-
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Lead free / RoHS Compliant
Other names
Q2172565
'{$STAMP BS2}
Main:
Please carefully observe the behavior of the LED on the front of the Stamp PLC. You should see it pulse
off for a fraction of a second (18mS), then remain on steadily for ~2.3 seconds. This behavior is normal,
considering the fact that our program is incomplete.
Every BASIC Stamp has a built-in watchdog timer. A watchdog timer monitors the program's behavior
and always counts down. If the watchdog timer ever expires, it automatically resets the Stamp and the
user program (your basic program) starts over from the beginning. Each time a valid Stamp instruction is
completed, the watchdog timer is reset, thereby staving off a watchdog reset. Why is the reset occurring
in the example above? The reason is that we have not specified what the Stamp is to do after completing
the "LOW 14" command. Essentially, the imaginary pointer that points to "the next instruction to do" has
been allowed to "fall off into the weeds". To make this program complete and to keep our program
pointer on the path, it is necessary to contain Stamp programs within a loop.
'{$STAMP BS2}
'{$PBASIC 2.5}
Main:
Amending your program to reflect the changes made above should rectify the watchdog reset problem.
In other words, the LED representing P14 will remain on steadily. It is important to understand the
nature of a watchdog reset. Depending on your program, a logical error in your program could cause a
watchdog reset and you may not notice it if you don't know what to look for. Please be certain that your
program is functioning exactly as designed, (i.e. no resets), before placing it in service.
The PBASIC syntax offers many features that, if used, can greatly enhance the readability of your Stamp
code. It is desirable to make your program as readable as possible. Doing so will make bugs easier to
find, and perhaps three years from now, when a customer requests a function added to your program
and you've forgotten how it works, a brief read through your program and it's comments reveal just how
everything works. One way to enhance the readability of your program is to use descriptive aliases and
comments where possible.
'{$STAMP BS2}
'{$PBASIC 2.5}
Pump
Main:
As you can see, the program has been modified to switch on the pump every ten seconds for duration of
one second.
The output drivers used by the Stamp PLC are fully protected high-side drivers. This means that if too
much current is drawn, or if they get too hot, they shutdown automatically. Additionally, once they cool
Parallax, Inc. • Stamp PLC (#30064) • Version 1.8 • 12/29/2003
LOW 14
LOW 14
DO : LOOP
DO
LOOP
LOW
PAUSE 1000
HIGH Pump
PAUSE 10000
PIN
Pump
14
' Stamp type directive
' Make P14 and output and drive it low (turn on)
' Stamp type directive
' Stamp expanded syntax directive
' Make P14 and output and drive it low (turn on)
' Wait here until hard reset
' Stamp type directive
' Stamp expanded syntax directive
' P14 is connected to the pump output
' Turn on the Pump
' let it run for 1 second
' Turn off the Pump
' Wait for 10 seconds
' then repeat
Page
7