View previous topic :: View next topic |
Author |
Message |
shapito
Joined: 21 Feb 2012 Posts: 9
|
Connect two board of CCS CAN Bus |
Posted: Tue Feb 21, 2012 5:17 am |
|
|
I still blur in connect two prototype boards on CCS CAN Bus... Can someone help me? |
|
![](templates/subSilver/images/spacer.gif) |
RF_Developer
Joined: 07 Feb 2011 Posts: 839
|
|
Posted: Tue Feb 21, 2012 5:37 am |
|
|
Yes. There are people here with CAN experience and skill.
Please tell us what the problem is. Tell us PIC types, CCS compiler version, hardware set up etc. Post a SHORT program that shows the problem. Keep it simple.
RF Developer |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
![](templates/subSilver/images/spacer.gif) |
shapito
Joined: 21 Feb 2012 Posts: 9
|
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Feb 22, 2012 12:48 pm |
|
|
You have the CCS CAN bus board. Use their example files for that board:
Quote: |
c:\program files\picc\examples\ex_can_ccs_a.c
c:\program files\picc\examples\ex_can_ccs_b.c
|
|
|
![](templates/subSilver/images/spacer.gif) |
shapito
Joined: 21 Feb 2012 Posts: 9
|
|
Posted: Mon Feb 27, 2012 8:11 am |
|
|
i still cant do switch from node A to control led at node B.
i still not understand about can bus protocol... |
|
![](templates/subSilver/images/spacer.gif) |
RF_Developer
Joined: 07 Feb 2011 Posts: 839
|
|
Posted: Mon Feb 27, 2012 9:08 am |
|
|
shapito wrote: | i still cant do switch from node A to control led at node B.
i still not understand about can bus protocol... |
Try to forget about node A,B etc. CAN is a message based broadcast bus. There are no addresses for nodes to use. You cannot send a message from one place to another. What you can do is send out messages for any node that wants to listen. Its up to the receiving node to act on the message if it needs to.
So, so you might send out a message from one node that has a particular message ID: a message type if you understand what I mean. All the nodes know that that message ID means "LED control". They also know that if the first data byte is zero it means LED off, and a 1 means LED on. In fact you can make all the bits in the message means a LED on or off, and so control up to 8 LEDs with each byte of the message, and there can be up to 8 bytes in any CAN message.
Now lets suppose node C and D receives this message, but they don't have any LEDs so they simply ignore that message. Node B does have LEDs so it's interested in that message, and lights its LEDs as specified by the message.
Node A cannot know whether its messages are being listened to or acted on, all it can tell is that at least one node received it. There are no message acknowledgements, If you want to do any, and it is not in the spirit of CAN, then you have to make a specific acknowledgement message.
Some people use the message ID as an address, but that's not what the ID is meant for. The ID identifies the message type not it's destination. There is not meant to be and desitination in CAN.
It takes a bit of time to get your head around all this. Once you understand it it will all be quite natural and simple, Personally I like this message passing concept.
RF Developer |
|
![](templates/subSilver/images/spacer.gif) |
shapito
Joined: 21 Feb 2012 Posts: 9
|
|
Posted: Mon Feb 27, 2012 9:19 am |
|
|
can you give me 1 simple coding?...So that can make me more understand. |
|
![](templates/subSilver/images/spacer.gif) |
dyeatman
Joined: 06 Sep 2003 Posts: 1924 Location: Norman, OK
|
|
Posted: Mon Feb 27, 2012 9:22 am |
|
|
As PCM said earlier, use the supplied examples. They are as simple as it gets.
I adapted them to my test environment (changed PIC numbers etc) and it worked the first time.
Have you gotten the nodes to "talk" at all?
If so, tell us what works so far...
If not, tell us what you have done so far... _________________ Google and Forum Search are some of your best tools!!!!
Last edited by dyeatman on Mon Feb 27, 2012 9:38 am; edited 1 time in total |
|
![](templates/subSilver/images/spacer.gif) |
shapito
Joined: 21 Feb 2012 Posts: 9
|
|
Posted: Mon Feb 27, 2012 9:35 am |
|
|
really?...what function that you have done? |
|
![](templates/subSilver/images/spacer.gif) |
dyeatman
Joined: 06 Sep 2003 Posts: 1924 Location: Norman, OK
|
|
Posted: Mon Feb 27, 2012 9:41 am |
|
|
What I have done is much more complex than what you are working with
right now. When I started I just used the CAN bus examples to get two
working nodes and expanded from there.
In this case I think it best to focus on what you are doing and get you up
and working with the examples to better understand CAN first...
If you have the CAN board, program the examples into the chips and tell us
if it works. If it does not, you have something more serious that must be
fixed first. _________________ Google and Forum Search are some of your best tools!!!! |
|
![](templates/subSilver/images/spacer.gif) |
shapito
Joined: 21 Feb 2012 Posts: 9
|
|
Posted: Mon Feb 27, 2012 9:53 am |
|
|
Can you explain about this?
Code: | #define WRITE_REGISTER_D_ID 0x400 |
and also this:
Code: |
can_init();
can_putd(0x100,0,0,1,TRUE,FALSE); |
|
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Feb 27, 2012 4:40 pm |
|
|
Look in the CAN bus driver file. It has explanations of the driver functions:
Quote: |
c:\program files\picc\drivers\can-18xxx8.c |
|
|
![](templates/subSilver/images/spacer.gif) |
jgschmidt
Joined: 03 Dec 2008 Posts: 184 Location: Gresham, OR USA
|
|
![](templates/subSilver/images/spacer.gif) |
|