Ok , first you should master the SPI communication i.e you should first implement at least two functions to read , write registers of the MCP 2515.
I suggest the following pseudo code
Write_CAN( register_address, register_data){
1-put oxo2 in SPI buffer --> write instruction
2- wait until transmission flag is set
3- clear flag
4- put register address in SPI buffer
5- wait until transmission flag is set
6- clear flag
7-put register data in the SPI buffer
8- wait until transmission flag is set
9- clear flag
}
Read_CAN( register_address, register_data){
1-put oxo3 in SPI buffer --> read instruction
2- wait until transmission flag is set
3- clear flag
4- put register address in SPI buffer
5- wait until transmission flag is set
6- clear flag
7-put dummy data in the SPI buffer
8- wait until transmission flag is set
9- clear flag
10- now the register data is in the SPI buffer
11-return data
}
writing these two functions will facilitate writing the remaining interface code. All what you will need then is to fill the configuration registers using the previous write_CAN function.
Is the at89s51 really necessary? There are ucs with built-in can modules (like at90canxx from atmel or there are lot of pics from microchip like the 18f4480), so you have one problem less.
i have put forward some queries about CAN controller some days before, yasser_shoukry have replied me with an algorithm,thanks.but i feel some dificult in writting C code,My project is to form aCAN network with 3 nodes,can any one help me how to transmit and to recieve the messages,then masking and filtering,iam using a PIC controller, CAN controller(MCP 2515) and a CAN transceiver(MCP2551).
hi sir..
i want to work on can protocol..using mcp2515 with atmega 8 uc..i want to ask what initial steps i should take regarding hardware and programming so that i willl able to get data from CAN protocol vehicle easily..
---------- Post added at 23:34 ---------- Previous post was at 23:32 ----------
hi seenuvel
if you done this project then kindly help me in this project..i need you help