PDA

View Full Version : Can examples!



jkbpower
- 25th April 2007, 07:17
Hi,
I have just started a project with a 18F6585 and a 6680.
I now want to use CAN to communicate with our vehicles to control different funktion and to read out data as speed etc.
Is ther any ready functions in PBP or something that will make the programming easier.
I undersatand that CAN is a little hard to get going.
Can anyone help me with some example code or anything.
I just want to send and recive messages on a CAN network.
/JKBPower

T.Jackson
- 25th April 2007, 08:36
Hi,
I have just started a project with a 18F6585 and a 6680.
I now want to use CAN to communicate with our vehicles to control different funktion and to read out data as speed etc.
Is ther any ready functions in PBP or something that will make the programming easier.
I undersatand that CAN is a little hard to get going.
Can anyone help me with some example code or anything.
I just want to send and recive messages on a CAN network.
/JKBPower

Good luck with that. I think you'd probably find that most manufactures use different protocols. In other words - if managed to master the ECU of say a Nissan 300ZX, this doesn't necessarily mean that you could dive straight in and work on say a 3000GT. Too diverse by any means. This being the main reason why a language like PBP wouldn't directly provide support for it.

jkbpower
- 25th April 2007, 09:07
Yes I know its difficult to manage the ECU but thats not what I want.

We built security vehicles and use PLC systems today.
I communicate with canbus to controll central lockings,windows etc.
This is not hard to control but now I want to do this with my own PIC based controller.

T.Jackson
- 25th April 2007, 10:41
Yes I know its difficult to manage the ECU but thats not what I want.

We built security vehicles and use PLC systems today.
I communicate with canbus to controll central lockings,windows etc.
This is not hard to control but now I want to do this with my own PIC based controller.

You're not interested in the ECU? Then how will you manage to read speed and other data as your first initial post stipulates.
Everything in the CAN except the ECU is node. If you can't understand the ECU then how can you talk to the nodes? I'm puzzled.

DynamoBen
- 26th April 2007, 02:12
Actually communicating with one vehicle is the same as the next, because they all use the OBDII protocol. The SAE have the OBDII standard for purchase. While some of the more advanced functions like reprogramming are manufacturer specific the diagnostic items like speed and RPM are the same on every vehicle and outlined in their document(s).

I had the oppritunity to read through the OBDII standard while working on another project, needless to say its tedious to communicate on the buss. I ended up integrating an OBDII to serial IC into my design to simplify things, ELM electronics sells it (ELM327).

The following will give you a taste of the protocol and how it works. This document is geared to VPW but the concepts remain the same.

http://www.lightner.net/lightner/bruce/Lightner-183.pdf

skimask
- 26th April 2007, 04:05
That ELM327 chip rocks!
I'm about to order a 2nd load of PCBs anydays now. Almost can't keep enough on hand.

arniepj
- 26th April 2007, 17:36
You said anything.Attached are code files that appear to be PBP.I downloaded them from somewhere about 6 years,but never used them.I do know they were for use with a can bus interface chip MCP2510 controlled thru the MSSP port of a 16F877 using SPI.

jkbpower
- 27th April 2007, 06:20
Thanks!
Maybe I can use some of that code.
The 18F6585 have an own ECAN modul so I think its a lot different than using the stand alone chip.
But I´m going to look at this.
Oboy!!! I have a lot to learn about CAN :-)
/JKBPower

mister_e
- 27th April 2007, 06:27
CAN is nice, but not as easy as USART, SPI, I2C or some part of USB.

At least once you understand the concept, it's easy.