Specifications
BASIC Stamp II Application Notes
Page 356 • BASIC Stamp Programming Manual 1.8 • Parallax, Inc.
Custom Shift Routines. The key to successful use of the Shift instruc-
tions is obtaining, reading, and understanding the manufacturer’s
specification sheets. In addition to providing the data required to fill in
the parameters for the Shift instructions, the data sheets document
configuration bits, operating modes, internal register arrangements,
and lots of other valuable data.
Sources. The components used in the example applications are avail-
able from Digi-Key, 710 Brooks Avenue South, P. O. Box 677, Thief River
Falls, MN 56701-0677; phone 1-800-344-4539. Packages of components,
documentation, and source code listings for the Stamp I, Stamp II and
PIC microcontrollers are available from Scott Edwards Electronics;
phone 520-459-4802, fax 520-459-0623. These packages, known as
AppKits, are available for the LTC1298 ADC, DS1620 digital thermom-
eter, Xicor X25640 8-kB EEPROM, and others.
Program listings. These programs may be downloaded from our
Internet ftp site at ftp.parallaxinc.com. The ftp site may be reached di-
rectly or through our web site at http://www.parallaxinc.com.
' LISTING 1. SHIFTOUT TO 74HC595
' Program: 74HC595.BS2 (Demonstrate 74HC595 shift register with Shiftout)
' This program demonstrates the use of the 74HC595 shift register as an
' 8-bit output port accessed via the Shiftout instruction. The '595
' requires a minimum of three inputs: data, shift clock, and latch
' clock. Shiftout automatically handles the data and shift clock,
' presenting data bits one at a time on the data pin, then pulsing the
' clock to shift them into the '595's shift register. An additional
' step—pulsing the latch-clock input—is required to move the shifted
' bits in parallel onto the output pins of the '595.
' Note that this application does not control the output-enable or
' reset lines of the '595. This means that before the Stamp first
' sends data to the '595, the '595's output latches are turned on and
' may contain random data. In critical applications, you may want to
' hold output-enable high (disabled) until the Stamp can take control.
DataP con 0 ' Data pin to 74HC595.
Clock con 1 ' Shift clock to '595.
Latch con 2 ' Moves data from shift register to output latch.
counter var byte ' Counter for demo program.
' The loop below moves the 8-bit value of 'counter' onto the output
2: Using Shiftin & Shiftout










