I am trying to read some data from a 89c4051 clocked at 12MHz. The program was written in BASCOM and the shiftout routine is known:
(Int = P1.5)
(2 – LSB shifted out first when clock goes low)
Transfer_data:
Int = 0
Delay
Int = 1
Shiftout P1.7 , P1.6 , Inf , 2
Shiftout P1.7 , P1.6 , Cur , 2
Shiftout P1.7 , P1.6 , Pea , 2
Shiftout P1.7 , P1.6 , For , 2
Shiftout P1.7 , P1.6 , Ref , 2
Shiftout P1.7 , P1.6 , Tem , 2
Return
The 89c4051 was originaly designed to send only data so there is noway of accepting anything. I have wired an Uno as an SPI slave
P1.7 -> 11 (MOSI - dataPin)
P1.6 -> 13 (CLK - clockPin)
P1.5 -> 10 (SS - ssPin)
but I was not able to receive correctly any valid data using a very similar arduino routine.
while (!digitalRead(ssPin)) {}
Inf = shiftIn(dataPin, clockPin, LSBFIRST);
Cur = shiftIn(dataPin, clockPin, LSBFIRST);
Pea = shiftIn(dataPin, clockPin, LSBFIRST);
For = shiftIn(dataPin, clockPin, LSBFIRST);
Ref = shiftIn(dataPin, clockPin, LSBFIRST);
Tem = shiftIn(dataPin, clockPin, LSBFIRST);
From everything I have read so far, I suspect Arduino's shiftIn is probably too slow but I am not sure. Is it possible to decode it correctly using SPI?