Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to interface CAN controller(MCP 2515) with AT89s51 controller?

Status
Not open for further replies.

seenuvel

Newbie level 5
Joined
May 18, 2007
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,347
can any one tell me how to interface CAN controller(MCP 2515) with AT89s51 controller
 

seenuvel

Newbie level 5
Joined
May 18, 2007
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,347
Re: CAN Protocol

The processor interface is SPI
 

yasser_shoukry

Full Member level 4
Joined
May 31, 2006
Messages
233
Helped
25
Reputation
54
Reaction score
5
Trophy points
1,298
Location
Cairo - Egypt
Activity points
2,749
CAN Protocol

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.
 

    seenuvel

    Points: 2
    Helpful Answer Positive Rating

z01z

Junior Member level 2
Joined
Oct 10, 2004
Messages
24
Helped
7
Reputation
14
Reaction score
0
Trophy points
1,281
Activity points
150
Re: CAN Protocol

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.
 

seenuvel

Newbie level 5
Joined
May 18, 2007
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,347
Re: CAN Protocol

hi

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).
 

viks

Member level 1
Joined
Oct 8, 2005
Messages
40
Helped
2
Reputation
4
Reaction score
0
Trophy points
1,286
Activity points
1,604
Re: CAN Protocol

I can help you with that .
What do u need.
Complete code or you want to debug ur own code ?

Best way to learn is debug ur own. :D
 

raowakeel

Junior Member level 3
Joined
Mar 8, 2012
Messages
30
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,288
Location
pakistan
Activity points
1,433
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
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top