You’ll get data in & out of the master faster than PBP if you express both the read and write routines in a verbose fashion such as below write routine.
It might need delays between pin writes that could be as short as @nop commands, and the routine is also a candidate for RWM error without adding
a shadow register for port latching (mind you, PBP SHIFTOUT command is probably no different). It’s probably faster again if the chip has hardware SPI.
Code:
byte data_out'
WriteSPI:
‘ bit 7
SPICLOCK = 0’
SPIOUT = 0’
SPICLOCK = 0’
SPIOUT = data_out.bit7’
SPICLOCK = 1’
‘ bit 6
SPICLOCK = 0’
SPIOUT = 0’
SPICLOCK = 0’
SPIOUT = data_out.bit6’
SPICLOCK = 1’
‘ and so on for the rest of the bits…
RETURN
Bookmarks