View previous topic :: View next topic |
Author |
Message |
khoichi Guest
|
CAN-loopback mode |
Posted: Tue Jul 26, 2005 4:59 pm |
|
|
can someone give me an overview on how to get into LOOPBACK MODE? I'm using the libraries can18xxx8.c and can18.xxx8.h. I want to test what's in the recieve buffers of PIC18F2480.
thanks |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Arlene Guest
|
|
Posted: Thu Jul 28, 2005 12:26 pm |
|
|
when we tried to put it in loopback mode and print out what was received, we got nothing. what could be wrong? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jul 28, 2005 12:44 pm |
|
|
Just get a 18F458 and use it to learn the CAN bus.
You have spent weeks on the 18F2480 and it doesn't work.
How much time do you intend to waste on this chip ?
In your code in the other thread,
http://www.ccsinfo.com/forum/viewtopic.php?t=23811
you've taken pieces of the CCS EX_CAN.C demo program,
but you've left out important parts. You're calling can_getd()
without checking to see if any messages are available by
first calling can_kbhit(). CCS shows completely how to
do it in EX_CAN.C, but you have ignored it. |
|
|
Arlene Guest
|
|
Posted: Thu Jul 28, 2005 3:50 pm |
|
|
It works! Thanks. The can_getd function didn't work, so we wrote our own and figured it out. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Jul 29, 2005 12:07 am |
|
|
For CAN bus loopback code, see this thread. Newguy is using a
18F4580, which is similar to your 18F2480. If the code works
for his PIC, then it probably will work with the 18F2480.
http://www.ccsinfo.com/forum/viewtopic.php?t=23825 |
|
|
|