View previous topic :: View next topic |
Author |
Message |
LMS_EE
Joined: 27 Oct 2010 Posts: 9 Location: Georgia VT
|
|
Posted: Mon Nov 01, 2010 9:27 am |
|
|
Hey PCM
Thanks for the step in the right direction. Can you do me a favor when you get a chance and see if you can see canbus output messages on the TX pin of the first MCU when you send it an RS232 command? Can you see the messages when the second MCU is not connected to the first one?
Thanks! |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Nov 01, 2010 1:43 pm |
|
|
I used the program that I posted earlier, and compiled it for "Board #1"
and programmed it into the test board. This test is done with Board #1
only. It is not connected to Board #2. It just has the PIC, and MCP2551
and the 120 ohm terminator resistor. It's just one board by itself.
Initially, the TXD pin (pin 1) on the MCP2551 is at a high level (+5v).
I then pressed the Enter key on the PC, while running TeraTerm.
The TXD pin now has constant activity. It has pulses for 2.6ms, then
a high level for 1ms, and then repeats the same pattern constantly.
The RXD pin has the same pattern and levels as the TXD pin.
For the CANH pin, it was sitting at +2.5v initially. When I press the Enter
key once, it puts out constant activity, the same pattern as the above,
but voltage levels are from 2.5v to 3.5v.
For the CANL pin, it was also sitting at +2.5v initially. Whe I pressed Enter
it put out the same constant activity pattern, but with voltage levels from
1.5v to 2.5v. |
|
|
parchao
Joined: 08 Jan 2011 Posts: 3
|
problems board2 |
Posted: Sat Jan 08, 2011 11:32 am |
|
|
hi
I am working with an internal oscillator with pic18f4585 8MHz. I like to know how to set the baud rate since the Board2 does not enter the first function
if(can_kbhit()==true) |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Jan 08, 2011 2:53 pm |
|
|
The CAN bus baud rate is set by the can_set_baud() function, which
is called by can_init().
This thread explains how to use the MBTime program to calculate the
values for can_set_baud():
http://www.ccsinfo.com/forum/viewtopic.php?t=22138
It also has a link to download the MBTime program. |
|
|
parchao
Joined: 08 Jan 2011 Posts: 3
|
problems continued |
Posted: Thu Jan 13, 2011 4:59 pm |
|
|
hi
I set my CAN communication accept any message because it is only way to login to the can_kbhit function () of board2.
Anyone know if you change the mode of reception does not enter the function?
I checked the values are different from those received and sent. |
|
|
collink
Joined: 08 Jan 2010 Posts: 137 Location: Michigan
|
Re: problems continued |
Posted: Thu Jan 13, 2011 7:32 pm |
|
|
Umm..... HUH?!?! I know a decent amount about CANBus development for PIC chips so I will help you if I can. However, I can't make sense of what you are asking. Can you explain it again?
parchao wrote: | hi
I set my CAN communication accept any message because it is only way to login to the can_kbhit function () of board2.
Anyone know if you change the mode of reception does not enter the function?
I checked the values are different from those received and sent. |
|
|
|
parchao
Joined: 08 Jan 2011 Posts: 3
|
problems continued |
Posted: Fri Jan 14, 2011 1:24 pm |
|
|
hi
I have configured the reception mode as CAN_RX_ALL and it communicates but the values from the sendings and receptions are different.
This is my problem, can anyone help?
Thanks. |
|
|
collink
Joined: 08 Jan 2010 Posts: 137 Location: Michigan
|
Re: problems continued |
Posted: Fri Jan 14, 2011 8:43 pm |
|
|
parchao wrote: | hi
I have configured the reception mode as CAN_RX_ALL and it communicates but the values from the sendings and receptions are different.
This is my problem, can anyone help?
Thanks. |
You mean that you send certain data and when you receive it it is actually different? Could this be a result of endian issues? (That is, are you expecting least significant byte first on an int16 or int32 but really getting most significant byte first?) Can you post an example (as short as possible) of a program that causes this error? Remember that you don't have to, and in fact should not, post any CCS source code. |
|
|
|