Hi,
I don't know if it's you or me who are the most confused right now.....
You seem to be mixing SHIFTIN/SHIFTOUT with the use of the MSSP module, use either or. And, previously you said you used SEROUT on another PIC to send data, then you can't use SHFTIN to receive it - if that's what you're trying to do. And, no, you can't use any of the methods to shift data into the SDO pin since that is the data output pin.
Code:
ActualData var word[8]
j var byte[8]
B0 var byte
Any reason for ActualData to be WORDS?
Code:
send1:
SHIFTIN SDI, SCK, MSBPRE, [ActualData\8]
j=ActualData
SHIFTOUT SDO, SCK, MSBFIRST, [j]
Not sure what the purpose of this is but there's no reason to assign the value of ActualData to J and then send J out using SHIFTOUT, you could just as well shift out ActualData directly (instead of a copy of it).
Code:
For j = 0 to 7 ' loop for 8 characters
SSPBUF = 0 ' write to SSPBUF to start clock
GoSub letclear ' wait for receipt
B0[j] = SSPBUF ' store received character in array
Next j ' get next character
Return
Here you're treating B0 as an array when it's decalred as a BYTE. This is a critical error as it will write to memory location "beyond" B0 and corrupt what ever is there. PBP does not do any boundry checks on arrays so you need to be careful.
This post probably isn't of much help to you but I've quite honestly lost track of what exactly you're trying to do. Now, we've got SERIN, SHIFTIN/SHIFTOUT and the use of the MSSP module in the mix - all at once and I'm struggeling to keep up. Again, I suggest that you get used to various ways of doing SPI by interfacing something simpler than the TRH031M - which, by the way, I've never used so I don't know how it works. But I looked, briefly, at the datasheet and nowhere can I find that you're supposed to send "?" to start a "conversion" - I thought the chip was for RFID communications, not a converter....
/Henrik.
Bookmarks