SPIOUT
Syntax
SPIOUT CSpin, outpin, clockpin, [OutputList] OutputList = expr | arrayname \ count | stringname$ {\count} | "string" { , OutputList}
Description
SPIOUT supports the loosely defined serial protocol used by a variety of manufacturers. The desired device is selected by asserting CSpin LOW. If there is no cspin, the value should be set to -1.
In the simplest case, outpin is used to output data clocked by clockpin, from the OutputList.
[OutputList] can contain a list of constants, variables, "constant-string" or stringame$ The latter will send out bytes starting from stringname$(0) until a 0 byte is read.
Data is shifted out LSB first and each element of the OutputList is treated as a byte. The REV operator can be used to change the bit order. Data is shifted out at 1.4 Mbits/sec. (version 6.07 and before this was 800 Kbits/sec)
Example
SPIOUT
4,1,2,[$04,GAIN]
' set the GAIN register of an ADS7870
SPIIN 4,3,2,1,$44,[GAIN}
' read the GAIN register back
Differences from other BASICs
- no equivalent in Visual BASIC
- no equivalent in PBASIC