The BASIC Stamp 2 is truly an amazing design. However, it has its limitations. One is counting events. Another is the PWM command. In each case, the STAMP can perform the function, but that is about all it can do.
Assume you are counting blips from a rainfall gauge, where each blip is 0.01 inches of rainfall. The designer is faced with virtually dedicating a $49 Basic Stamp 2 to this function as any time spent outside the COUNT command is risking missing one or more blips.
Undergraduate student Mischelle Savary is nearing the completion of a PIC12C508 design that performs a continuous count function, periodically polling the BASIC Stamp as to whether it wants the data and if not, adding the number of counts over the previous second to the total accumulated counts since the last serial transfer. If the Stamp desires the data, it exerts a zero on a flow control lead and the PIC sends the accumulated counts at 9600 baud. This will be available about May 10, '98. It will consist of a programmed PIC12C508 (8-pin DIP) and 4.0 MHz ceramic resonator and cost about $4.00.
(I'm none too sure that Mischelle really believes me when I note that this is a significant design that people need. Please give her encouragement in the form on an e-mail to email@example.com).
In the case of PWM we have the same problem. One can control the speed of a single motor, but any time spent out of the PWM command will cause the motor to slow. Controlling more than one motor at a time is not feasible.
Of course, one can devote a Stamp to performing only the PWM function for a single motor, but that is $49. We offer a far less expensive alternative.
We have completed the development of a PIC based design which provides the PWM function. This may be interfaced with a BASIC Stamp 2 or similar using serial 9600 baud. This now available.
This is implemented using a PIC12C508 (8-pin DIP) and a 4.0 MHz ceramic resonator.
The PIC spends nominally 250 msecs outputting on the PWM output at a specified DUTY, where DUTY is in the range of 0 to 255. It then exerts a zero on output READY_0 which is an invitation for the Stamp to send an updated DUTY. If no serial data is received from the the Stamp on input SERIN within one millisecond, the PIC brings READY_0 high and returns to the 250 msec cycle of outputting on the PWM output.
However, if serial data is received from the Stamp, this becomes the new DUTY. The PIC brings READY_0 high and resumes the 250 msec of PWM output using the new value of DUTY.
Thus, a simple Stamp 2 interface is summarized in the following;
SEROUT 7\8, 84, 500, TIMEOUT, [DUTY]
Note that Stamp output P7 is connected to PIC input SERIN. PIC output
READY_0 is connected to Stamp input P8.
The above statement monitors the READY_0 for up to 500 msecs and when it goes low, sends the new DUTY at 9600 Baud. TIMEOUT should not normally occur. It would indicate the PWM PIC is not connected.
The PWM output is configured as an output while actually performing the PWM operation. During the one millisecond when the PIC is monitoring for a new DUTY from the Stamp, it is at a high impedance.
Thus, in applications where the PWM output is charging a capacitor so as to generate a DC voltage, the high impedance assures the capacitor will hold its charge.
In driving a DC motor using an L293 Dual "H" bridge or similar, the user may wish to add either a pulldown or pullup resistor so as to define this time when the PWM output is not at a low impedance logic one or logic zero.
Access is provided to the PICs /MCLR input. For normal operation, this is left open. However, some users may wish to this to rapidly stop a motor by bringing the /MCLR low. When low, the PIC is in a reset mode and all leads (READY_0, SERIN and PWM) are at a high impedance. On bringing the /MCLR input high the PIC performs the PWM function with a default DUTY of zero.
PWM Kit - $10.00. This is a kit intended for evaluation. It includes two PWM PICs, two 4.0 MHz resonators, our logic probe and documentation.
The documentation includes assembly instructions and typical BASIC Stamp applications including generating a DC Voltage, displaying a quantity on a 200 mV panel meter and controlling a DC motor using an L293 "H" Bridge.
PWM PIC - $3.50. This includes only the PIC.
4.0 MHz resonators are available at $0.75. The L293 is $2.00 and a clip on heat sink is $0.50.
As with all of our manuals and kits, if you are not totally satisfied, simply return to material for a full refund.