Pages: [1]   Go Down
Author Topic: New MCP2515 CAN Library Available  (Read 8590 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Last month I bought a CAN shield from Sparkfun in order to display gas mileage statistics in realtime for my OBD2-compatible car.  I could not find a CAN library the did what I needed written in English, so I decided to write my own from scratch.  I thought I would share it, in case it might be useful to anyone else.

The library has the following functions:
static boolean initCAN(int baudConst);
static boolean setCANNormalMode();
static boolean setCANReceiveonlyMode();
static boolean receiveCANMessage(CANMSG *msg, unsigned long timeout);
static boolean transmitCANMessage(CANMSG msg, unsigned long timeout);
static byte getCANTxErrCnt();
static byte getCANRxErrCnt();
static long queryOBD(byte code);

It includes a tested example to display miles per gallon on an LCD display (I have been using this in my car for the past several weeks).

https://github.com/franksmicro/Arduino/tree/master/libraries/MCP2515


Frank

Logged

0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 91
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I offered my MCP2515 library to Sparkfun, but they never posted it.

Mines strictly CAN though, no OBDII.  Going to take a peek at yours to see what you've done on the OBDII side.
Logged

0
Offline Offline
Edison Member
*
Karma: 16
Posts: 1579
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Cool franksmicro!!

I´ve been tinkering with CAN bus for a while.....

http://real2electronics.blogspot.com/2010/06/can-bus-mcp2515.html

I´m sorry,it´s in spanish. It´s not a proper library, it´s an explanation how to use MCP2515 and the basic functions needed.
I´ve some links to code and hardware.... I´ve just added a link to your library!

DaveAK, if you also have a library, please let me know the link and I could add. There are no many projects with CAN bus and Arduino.


I did this...
[media]http://www.youtube.com/watch?v=CZGxynxNAlM&feature=player_embedded[/media]










 smiley-wink
« Last Edit: December 07, 2010, 06:07:03 pm by igorreal » Logged


0
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Igor, I like your LCD display!  Bet its expensive though.  I have the Sparkfun Nokia knockoff as well, but it is too small to display multiple parameters at a time so have not used it with OBD.
Logged

0
Offline Offline
Edison Member
*
Karma: 16
Posts: 1579
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
I've used a NewHaven Display => www.newhavendisplay.com/
It's very big and cool!!!!  ;D  I don't remember, but something less 70 dollars.
I've choosen one based on T6963 controller. I bought directly from this web.

It's very cool!!

Regards,


 smiley-wink
« Last Edit: December 08, 2010, 11:08:45 am by igorreal » Logged


0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 91
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Igor, I don't have my code posted any where yet.  I'll see about getting it up on google code or something like that.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

DaveAK, I'd be interested in your code too, I'm working on an CAN Arduino project and some code would be beneficial.
Logged

0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 91
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So as not to hijack Frank's thread, I've posted my code over on the thread I started a few weeks back:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1289195675
Logged

Pages: [1]   Go Up
Jump to: