pin1 on BChip Master to pin 1 on BChip Slave
pin2 on BChip Master to pin 2 on BChip Slave
pin3 on BChip Master to pin 3 on BChip Slave
pin9 on BChip Master to pin 9 on BChip Slave
No resistors between them - this a mistake ?
My master and slave code is below. I start the slave and let it loop around waiting for something/anything from the master.
Don't get any response from the slave of course

If it makes any difference, I also tried with no CS pin, i.e. SPIOUT(-1,3,2,0,1,outstring) and SPIIN (-1,2,3,1,0,-1,outstring,1,instring)
MASTER CODE
Code: Select all
// DONT NEED CS/SS PIN IF ONLY ONE SLAVE ?
// MISO pin 1 input
// MOSI pin 2 output
// CLK pin 3 output
// SS pin 9 output
#include <SPI.bas>
input(1)
output(2)
output(3)
output(9)
LO = 0
HI = -1
out(9) = HI
out(9) = LO
// SUB SPIOUT (CSpin, CLKpin, OUTpin, LSBfirst, OUTcnt, BYREF OUTlist AS STRING)
DIM outstring(10) as STRING
outstring(0) = chr(50)
print "BEGIN"
print x, outstring(x)
SPIOUT(9,3,2,0,1,outstring)
print "END"
SLAVE CODE
Code: Select all
// MISO pin 1 output
// MOSI pin 2 input
// CLK pin 3 input
// SS pin 9 input
// SUB SPIIN (CSpin, INpin, CLKpin, OUTpin, LSBfirst, OUTcnt, BYREF OUTlist as STRING, INcnt, BYREF INlist as STRING)
#include <SPI.bas>
output(1)
input(2)
input(3)
input(9)
DIM instring(10) as STRING
DIM outstring(10) as STRING
print "BEGIN"
do
SPIIN (9,2,3,1,0,-1,outstring,1,instring)
if instring(0) <> 255 then goto stop1
loop
stop1:
print "instring(0) ", instring(0)
print "END"