SHIFTIN - BASIC Stamp Command Reference
Page 310
•
BASIC Stamp Programming Manual 2.0b
•
www.parallaxinc.com
single data output pin. Another bit is output each time the appropriate
edge (rising or falling, depending on the device) appears on the clock line.
The SHIFTIN instruction first causes the clock pin to output low and the
data pin to switch to input mode. Then, SHIFTIN either reads the data pin
and generates a clock pulse (PRE mode) or generates a clock pulse then
reads the data pin (POST mode). SHIFTIN continues to generate clock
pulses and read the data pin for as many data bits as are required.
Making SHIFTIN work with a particular device is a matter of matching the
mode and number of bits to that device’s protocol. Most manufacturers
use a timing diagram to illustrate the relationship of clock and data. Items
to look for include: 1) which bit of the data arrives first; most significant bit
(MSB) or least significant bit (LSB) and 2) is the first data bit ready before
the first clock pulse (PRE) or after the first clock pulse (POST). Table 5.90
shows the values and symbols available for the Mode argument and Figure
5.38 shows SHIFTIN’s timing.
Symbol
Value
Meaning
MSBPRE
0
Data is msb-first; sample bits before clock pulse
LSBPRE
1
Data is lsb-first; sample bits before clock pulse
MSBPOST
2
Data is msb-first; sample bits after clock pulse
LSBPOST
3
Data is lsb-first; sample bits after clock pulse
(Msb is most-significant bit; the highest or leftmost bit of a nibble, byte, or word. Lsb is the
least-significant bit; the lowest or rightmost bit of a nibble, byte, or word.)
t
h
Clock
(Cpin)
Data
(Dpin)
-t
l
-
-pre modes
sample data
before
clock pulse
1st
-post modes
sample data
before
clock pulse
2nd
Figure 5.38: SHIFTIN Timing
Diagram. Refer to the SHIFTIN
Quick Answers table for timing
information on t
h
and t
l
.
Table 5.90: SHIFTIN Mode Values
and Symbols.
SHIFTIN
OPERATION
.
Summary of Contents for BASIC Stamp 1
Page 1: ...BASIC Stamp Programming Manual Version 2 0c...
Page 34: ...Quick Start Guide Page 32 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Page 340: ...ASCII Chart Page 338 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Page 342: ...Reserved Words Page 340 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Page 346: ...Conversion Formatters Page 344 BASIC Stamp Programming Manual 2 0b www parallaxinc com...