Specifications

Appendix C
Parallax, Inc. • BASIC Stamp Programming Manual 1.8 • Page 439
C
SHIFTOUT
BASIC STAMP I
NO EQUIVELANT COMMAND
BASIC STAMP II
SHIFTOUT dpin, cpin, mode, [data{\bits} {, data{\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..1 specifying the bit order. 0 or
LSBFIRST = lsb first, 1 or MSBFIRST = msb first.
DATA is a constant, expression or a bit, nibble, byte or word vari-
able containing the data to send out.
• BITS is a constant, expression or a bit, nibble, byte or word vari-
able in the range 1..16 specifying the number of bits of DATA to
send. The default is 8.
CONVERSION: BS1 R BS2
Code such as the following:
SYMBOL Count = B1 'Counter variable
SYMBOL CLK = 0 'Clock pin is pin 0
SYMBOL DATA = PIN1 'Data pin is pin 1
DIRS = %00000011 'Set Clock and Data pins as outputs
B0 = 125 'Value to be shifted out
FOR Count = 1 TO 8
DATA = BIT7 'Send out MSB of B0
PULSOUT CLK,1 'Clock the data
B0 = B0 * 2 'Shift the value left; note that this causes us
'to lose the value
NEXT Count 'when we’re done shifting