Yeah, but that register is in the MCP2515 - you're only assigning values to variables in the PIC, there's currently nothing that transfers the data TO the register in the MCP2515.
Look at the SPI section of the datasheet for the MCP2515, under Write instruction it says
The Write instruction is started by lowering the CS pin. The Write instruction is then sent to the MCP2515 followed by the address and at least one byte of data.
Then, looking at table 12-1 we can see that the Write instruction is (in binary) 00000010 or 2 in decimal. As you can see in your screenshot from the datasheet the adress of the TXBnDLC register(s) in the MCP2515 is $35, $45 and $55 respectively (apparently there's three of them, I haven't read enough yet to understand exactly what they do).
So to set the first of the TXBnDLC registers you need to shift out the WriteCommand (2), the adress ($35) and the actual data (7). The SPI section of the datasheet also tells us the device supports mode 0,0 and 1,1 and the timing diagram shows that it expects (and sends) MSB first. So, using SHIFTOUT the above would look something like
Code:
INCLUDE "modedefs.bas"
Write_Cmd CON %00000010 ' Value for the Write Command
TXB1DLC CON $35 ' Adress of the 1st TXBnDLC register in the MCP2515
LOW CS
SHIFTOUT DataPin, ClkPin, MSBFIRST, [Write_Cmd, TXB1DLC, 7]
HIGH CS
The example I linked to earlier and the article gadelhas wrote shows you how to set up and use the MSSP module.
/Henrik.
Bookmarks