Here is some sample code from meLabs. Maybe that would be of help to you.

http://www.melabs.com/resources/samples/pbp/spimast.bas
http://www.melabs.com/resources/samp...p/spislave.bas