View previous topic :: View next topic |
Author |
Message |
Sterngleiter
Joined: 07 Jan 2013 Posts: 90
|
Can Bus with Pic18f45k80 or MCP2515 |
Posted: Sat Oct 05, 2013 9:12 am |
|
|
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
|
|
Posted: Sat Oct 05, 2013 1:41 pm |
|
|
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:
In the author box, type in:
Set it for:
Quote: | Search For All Terms |
You will find several useful threads.
Also search for:
Again with author:
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
|
|
Posted: Sat Oct 05, 2013 2:50 pm |
|
|
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
|
|
Posted: Sat Oct 05, 2013 2:54 pm |
|
|
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
|
|
Posted: Sun Oct 06, 2013 3:14 am |
|
|
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
|
|
Posted: Sun Oct 06, 2013 3:41 am |
|
|
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
|
|
Posted: Sun Oct 13, 2013 1:58 pm |
|
|
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
|
|
Posted: Sun Oct 13, 2013 6:57 pm |
|
|
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
|
|
Posted: Mon Oct 14, 2013 4:56 am |
|
|
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
|
|
Posted: Mon Oct 14, 2013 6:51 am |
|
|
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
|
|
Posted: Mon Oct 14, 2013 10:30 am |
|
|
is the no one here knows about it, who can give me tips |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Oct 14, 2013 12:56 pm |
|
|
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. |
|
|
|