Specifications

BASIC Stamp II Application Notes
Parallax, Inc. • BASIC Stamp Programming Manual 1.8 • Page 353
2
Now you understand
the communications
hardware used in syn-
chronous serial periph-
erals; it’s basically just a
collection of shift regis-
ters, latches and other
logic. The Stamp II’s
built-in Shiftout and
Shiftin instructions pro-
vided general-purpose
tools for working with
this kind of hardware.
Let’s look at some ex-
amples.
Shift-Register Output
with Shiftout. The most
basic use for Shiftout is to
add an output-only port based on a shift register/latch combination
like the 74HC595 shown in figure 4. Listing 1 demonstrates how simple
it is to send data to a device like this.
QD
CLK
FF0
QD
CLK
FF1
QD
CLK
FF2
QD
CLK
FF3
Serial
Data In
Shift
Clock
QD
CLK
FF0
QD
CLK
FF1
QD
CLK
FF2
QD
CLK
FF3
Parallel
Data Out
Latch
Clock
Figure 3. A shift register plus a latch
makes a serial-to-parallel converter.
74HC
595
1
2
3
4
5
6
7
8
16
15
14
13
12
11
10
9
QB
QC
QD
QE
QF
QG
QH
GND
VCC
QA
DATA IN
OE
LATCH
CLK
RESET
SQH
+5
LEDs
470
(all)
BS2 pin 0
BS2 pin 2
BS2 pin 1
+5
Figure 4. Schematic to accompany 74
HC
595.
BS
2.
2: Using Shiftin & Shiftout