Set Spi clk, mosi, miso, mode
clk | port for clock output |
mosi | port for data (Master output, Slave Input) |
miso | port for data (Master input, Slave output) |
mode | communication mode |
bit 3: 0 = MSB start, 1 = LSB start | |
bit 2: 0 = wait at clock LOW, 1 = wait at clock HIGH | |
bit 1: Output sample point; 0 = before rising edge, 1 = after rising edge | |
bit 0: Input sample point; 0 = before rising edge, 1 = after rising edge |
The Set Spi
command must be used prior to the Spi command to ensure
the I/O ports are defined prior to sending or receiving data.
Const Device = CB280 Dim Dtin As Byte Set Spi 9,8,7,0 Dtin = Spi(Dtout,32)
For a more complete example, see the file C:\Program Files (x86)\ComfileTools\CublocStudio\CM100A in CUBLOC Studio's installation folder.