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

Can Bus with Pic18f45k80 or MCP2515

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



Joined: 07 Jan 2013
Posts: 90

View user's profile Send private message

Can Bus with Pic18f45k80 or MCP2515
PostPosted: Sat Oct 05, 2013 9:12 am     Reply with quote

I try with a pic18f45k80 Can bus communication build recently. I have examples in the "example PCWHD folder" I do not understand the procedures.
I even try with MCP2515 does not work as well.
Can anyone here tell me the connection with pic18f45k80 and with mcp2515.
I can not offer a code other than the example that everyone ought to have.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Oct 05, 2013 1:41 pm     Reply with quote

I have posted several articles on how to do this. They are in the forum
archives. Go to the CCS search page:
http://www.ccsinfo.com/forum/search.php
In the Search box, type in:
Quote:
18F*80 can bus

In the author box, type in:
Quote:
pcm programmer

Set it for:
Quote:
Search For All Terms

You will find several useful threads.


Also search for:
Quote:
MCP251*

Again with author:
Quote:
pcm programmer

You will find even more threads on MCP2510 and MCP2515.

I advise you to read all the threads, because many of them have links
to Can Bus schematics, how to do loopback mode, trouble-shooting tips,
how to change the baud rate, etc. You have to read all the threads.
Sterngleiter



Joined: 07 Jan 2013
Posts: 90

View user's profile Send private message

PostPosted: Sat Oct 05, 2013 2:50 pm     Reply with quote

I can not find anything
maybe you can give me address.
actually I'm looking for the processes, the sequence of setting
as For example, when CAN_INIT (); when CAN_Baud ..
what is EXTENDED_ID
I must make these settings when
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Oct 05, 2013 2:54 pm     Reply with quote

Quote:
I try with a pic18f45k80 Can bus communication build recently

What Can Bus device are you trying to talk to, by using the 18F45K80 ?
Is it another PIC ? Or is the other device something else ? What is the
second Can Bus device ?


Quote:
Can anyone here tell me the connection with pic18f45k80 and with mcp2515 ?

The 18F45K80 has a built-in Can Bus module, inside the PIC. The mcp2515
contains a Can Bus module. The mcp2515 is used with a PIC that doesn't
have a Can Bus module, such as the 18F4620.


Quote:
actually I'm looking for the processes, the sequence of setting
as For example, when CAN_INIT (); when CAN_Baud ..
what is EXTENDED_ID

These CCS example files all call can_init(). You can look in these files
to see how to do it:
Quote:
c:\program files\picc\examples\ex_can.c
c:\program files\picc\examples\ex_can_ccs_a.c
c:\program files\picc\examples\ex_can_ccs_b.c



Quote:
what is EXTENDED_ID ?

Read about it in this Wikipedia article:
http://en.wikipedia.org/wiki/CAN_bus#Extended_frame_format
and here:
http://www.intrepidcs.com/wavebps_dev/canbus_extendeddataframe.html
and here:
http://www.canbushack.com/blog/index.php?title=extended-ids-in-can-frames-what-will-they-think-of-next
Sterngleiter



Joined: 07 Jan 2013
Posts: 90

View user's profile Send private message

PostPosted: Sun Oct 06, 2013 3:14 am     Reply with quote

the second device is also a pic18f45k80,
I could also use the MCP2515.

I am using the trial of two Pic18f45k80 the internal oscillator 8MHz can lead to problems
Sterngleiter



Joined: 07 Jan 2013
Posts: 90

View user's profile Send private message

PostPosted: Sun Oct 06, 2013 3:41 am     Reply with quote

means "Loop_Back_mode" that same device also receives the signal sent back.
I may be in the mode, first a unit test
Sterngleiter



Joined: 07 Jan 2013
Posts: 90

View user's profile Send private message

PostPosted: Sun Oct 13, 2013 1:58 pm     Reply with quote

please help me

I use 2 x pic18f45k80, "can-18f4580" is automatically chosen by compiler, do I have to change something
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Oct 13, 2013 6:57 pm     Reply with quote

Quote:
I use 2 x pic18f45k80, "can-18f4580.c" is automatically chosen by compiler

That is the correct CAN driver file for the 18F45K80. You should always
use that driver file for your PIC. There is no special driver for the "K80"
series.

This thread explains how to make Loopback mode work for one 18F45K80:
http://www.ccsinfo.com/forum/viewtopic.php?t=48915

If you have two 18F45K80 boards, this thread has links to a test program
for two CAN bus boards to communicate together:
http://www.ccsinfo.com/forum/viewtopic.php?t=47545&start=2
It also has several links of schematics that show how to connect the
two boards. It shows the CAN bus driver chips (MCP2551) and the
120 ohm termination resistors. Make certain that you have all those
components on your boards, and that you connect them correctly.
Sterngleiter



Joined: 07 Jan 2013
Posts: 90

View user's profile Send private message

PostPosted: Mon Oct 14, 2013 4:56 am     Reply with quote

it does not work,
it may be that at all CAN pic18f45K80 can.
there is no "can_kbhit ()".
MCP on 2515 it does not work well.
I'll try the other times somehow no success.
I have no oscilloscope so I do not know if there's anything
comes.
I use the examples in the C compiler "EX_CAN_CCS_A.C,
EX_CAN_CCS_B.C and ex_can.c "without success.
Can someone please take time for myself and the details with me
go through.
Please, Please
I despair.
oxo



Joined: 13 Nov 2012
Posts: 219
Location: France

View user's profile Send private message

PostPosted: Mon Oct 14, 2013 6:51 am     Reply with quote

Sterngleiter wrote:
it does not work,
it may be that at all CAN pic18f45K80 can.
there is no "can_kbhit ()".



Yes there is. In can-18F4580.c macros section. Line 133

And I will comment that it's very difficult to design embedded systems without an oscilloscope. You really need one.
Sterngleiter



Joined: 07 Jan 2013
Posts: 90

View user's profile Send private message

PostPosted: Mon Oct 14, 2013 10:30 am     Reply with quote

is the no one here knows about it, who can give me tips
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Oct 14, 2013 12:56 pm     Reply with quote

Quote:
is the no one here knows about it, who can give me tips

I don't think we can help. You are a complete newbie. This forum not
about newbie training. We don't teach you all about electronics or
programming. If you have a problem in a specific area, then we can
help. This forum is basically a trouble-shooting forum. You do 90% of
your project, but you have difficulty on 10%. Then we help you with
the last 10%. In fact, we prefer that we only help you on less than 5%.


In your case, you need 100% help. You need a tutor. For your case, I
suggest a CAN Bus kit with an Exercise book to lead you through each
step so you can learn. CCS sells one:
http://www.ccsinfo.com/product_info.php?products_id=CANbuskit
You can buy the board, exercise book, cables, and an ICD programmer
for $149 USD. I don't know if CCS sells the kit for a lower price if
they leave off the ICD programmer. You could ask them.

But that CAN bus kit is what you need. Then follow the lessons in the
exercise book and you will learn how to use the CAN bus.
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