#include
<SHIFT.bas>
' source in /Program Files/Coridium/BASIClib
SUB SHIFTIN (INpin, CLKpin, LSBfirst, cnt)
SHIFTIN can be used for devices that are not covered by SPI, I2C or
1-Wire. Data is shifted in on INpin, and a positive clock is sent
on CLKpin for each bit.
Data and shift counts are stored in 3 arrays defined in the #include file
DIM
listIN(MAXshiftARRAY) ' values to be shifted
in
DIM listOUT(MAXshiftARRAY)
' values to be shifted out
DIM shiftCounts(MAXshiftARRAY)
While most other hardware functions use bytes, SHIFTIN is oriented for bit control. The shiftCounts defines the number of bits that will be shifted in (1 - 32) for each element of the listOUT array. If a shiftCounts is 0, it is assumed to be 8.
Data is shifted in at 300 Kbits/sec.