One thing you should do is preset the CLK and Data lines before calling Shiftout or Shiftin. Just set the clock to output and the correct idle state level, and Data to an input. Some parts could be picky about the starting state before you drop CS. Also, you didn't mention the clock idle state for the part you are using. That is very important also.
I would also just define one data pin variable. Since it is unidirectional, you only have one data pin anyway. Less confusing that way.
And is the output high level of the SPI device high enough for the PIC to accept as a high? The portB pins you are using are TTL and need at least 2V for a high.
Bookmarks