CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Controller Area Network CAN Vehicle Diagnostic Software

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
mxkid



Joined: 08 Apr 2008
Posts: 16

View user's profile Send private message

Controller Area Network CAN Vehicle Diagnostic Software
PostPosted: Mon Feb 10, 2014 1:08 pm     Reply with quote

Hi there,

I was wondering if anyone can help me with a project I'm working on. This is a bit of a step up from the normal projects I do so it’s a bit of a learning curve. I’m trying to get RPM via a vehicle CAN network. I have my PICDEM2 board loaded with an 18F4585 running at 20MHz. For the signal translation I’m using an MCP2551 which is linked directly to the high speed CAN of the vehicle.

I’m going use the EX_CAN software with the header file can-18xxxc.c but am a little unsure how to set a few things up. For example, how do I set the BRGCON registers to get a baud rate to 500kb/s? I’ve looked at the datasheet and I think if I set BRGCON1 to 19 that will equate to 2uS which is 500kb/s but I’m not 100% sure where to go from here.

Also, for a sanity check, the ECU has an address of 07e0 and I need to address the module with a request of 0x0c for the rpm and am expecting a reply of two bytes. So, with the line:

can_putd(tx_id, out_data, tx_len,tx_pri,tx_ext,tx_rtr);

am I correct in setting the registers as follows:

tx_id = 07e0 (send out to address)
out_data = 12 (0x0c for the RPM)
tx_len = 2 (two bytes of data)
tx_pri = 3
tx_ext = 0 (it’s not extended id – should be 11 bit)
tx_rtr = 1

Any help would be great. I think I’m nearly there as I've changed a few things but I don’t want to chase my own tail with a silly setup mistake!

Thanks in advance.

Very Happy
Ttelmah



Joined: 11 Mar 2010
Posts: 19499

View user's profile Send private message

PostPosted: Mon Feb 10, 2014 1:27 pm     Reply with quote

Use a tool to help you:
<http://www.bittiming.can-wiki.info/>

Trying to calculate all the timings yourself, is hard work.....

Best Wishes
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Feb 10, 2014 2:11 pm     Reply with quote

The drop-down box on that page has "Microchip PIC18F" grayed out.

This post will lead to the mbtime utility which will work for 18F CAN chips:
http://www.ccsinfo.com/forum/viewtopic.php?t=22138&highlight=mbtime
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group