Specifications

BASIC Stamp I and Stamp II Conversions
Page 438 • BASIC Stamp Programming Manual 1.8 • Parallax, Inc.
May be converted to the following code:
Value VAR BYTE 'Result of shifted data
CLK CON 0 'Clock pin is pin 0
DATA CON 1 'Data pin is pin 1
DIRS = %0000000000000001 'Set Clock pin as output and Data pin
as input
SHIFTIN DATA, CLK, MSBPRE, [Value\8]
CONVERSION: BS1 Q BS2
Code such as the following:
Value VAR BYTE 'Result of shifted data
DIRS = %0000000000000001 'Clock pin is 0 and Data pin is 1
SHIFTIN 1, 0, LSBPOST, [Value\8]
May be converted to the following code:
SYMBOL Value = B0 'Result of shifted data
SYMBOL Count = B1 'Counter variable
DIRS = %00000001 'Clock pin is 0 and Data pin is 1
FOR Count = 1 TO 8
Value = DATA * 256 + Value / 2 'Shift grab next data bit and shift right
PULSOUT CLK,1 'Postclock the data
NEXT Count