SHIFTOUT
Syntax
SHIFTOUT Dpin, Cpin, Mode, [OutputData{\ Bits} {, OutputData{
Bits}...}]
Description
SHIFTOUT has been kept as a compatable function with PBASIC. It can be used for devices that are not covered by SPI, I2C or 1-Wire.
While most other hardware functions use bytes, SHIFTOUT is oriented for bit control. The length of each variable defines the number of bits that will be shifted out (2 - 32). If Bit is not defined it is assumed to be 8.
- Mode = 0 data is shifted out LSB first
- Mode = 1 data is shifted out MSB first
SHIFTOUT does not allow arrays or strings to be part of the OutputList.
Data is shifted out of the device at 1.1 Mbits/sec.
Example
' use SHIFTIN/OUT to control an SPI EN28J60
rw=2
reg = $1b
io(6)=0
shiftout 3,4,1,[rw\3, reg\5, y] ' set reg $1B
io(6)=1
io(6)=0
shiftout 3,4,1,[reg]
'select the register
shiftin 5,4,0,[x]
'and
read it back
io(6)=1
Differences from other BASICs
- none from Visual BASIC
- simplified from PBASIC