#include <SPI.bas>                             ' source in /Program Files/Coridium/BASIClib

SUB SPIBI (CSpin, INpin, CLKpin, OUTpin, LSBfirst, BIcnt, BYREF OUTlist as STRING, BYREF INlist as STRING)


SPIBI supports the loosely defined serial protocol used by a variety of manufacturers.  The desired device is selected by asserting CS_pin LOW.  If there is no CS_pin , the value should be set to -1.

SPIBI will shift out1, out2, out3 bytes out on out_pin while reading 3 or more bytes into the InputList from in_pin.  For each bit the clk_pin will be pulsed. Data is shifted in/out MSB first. The LSBfirst can be used to change the bit order.

Data is shifted in/out at 220 Kbits/sec


Differences from other BASICs

See also