Specifications
Appendix C
Parallax, Inc. • BASIC Stamp Programming Manual 1.8 • Page 437
C
SHIFTIN
BASIC STAMP I
NO EQUIVELANT COMMAND
BASIC STAMP II
SHIFTIN dpin, cpin, mode, [result{\bits} { ,result{\bits}... }]
• DPIN is a constant, expression or a bit, nibble, byte or word vari-
able in the range 0..15 specifying the data pin.
• CPIN is a constant, expression or a bit, nibble, byte or word vari-
able in the range 0..15 specifying the clock pin.
• MODE is a constant, symbol, expression or a bit, nibble, byte or
word variable in the range 0..4 specifying the bit order and clock
mode. 0 or MSBPRE = msb first, pre-clock, 1 or LSBPRE = lsb first,
pre-clock, 2 or MSBPOST = msb first, post-clock, 3 or LSBPOST =
lsb first, post-clock.
• RESULT is a bit, nibble, byte or word variable where the received
data is stored.
• BITS is a constant, expression or a bit, nibble, byte or word vari-
able in the range 1..16 specifying the number of bits to receive in
RESULT. The default is 8.
CONVERSION: BS1 R BS2
• Code such as the following:
SYMBOL Value = B0 'Result of shifted data
SYMBOL Count = B1 'Counter variable
SYMBOL CLK = 0 'Clock pin is pin 0
SYMBOL DATA = PIN1 'Data pin is pin 1
DIRS = %00000001 'Set Clock pin as output and Data pin as input
FOR Count = 1 TO 8
PULSOUT CLK,1 'Preclock the data
Value = Value * 2 + DATA 'Shift result left and grab next data bit
NEXT Count










