Which CAN header is best for the 18F6680 ?
...and do I need to do anything for them to use the CANTX/RX on port G ?
Both header look like they use pins in port B.
Thanks
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Tue Dec 30, 2008 2:45 pm
The ECAN modules look similar between the 18F4580 and the 18F6680.
The block diagrams and register maps look similar. I don't have the time
to compare them in detail.
Here's the line that refers to Port B (the TRISB register) in can-18F4580.c:
Quote:
void can_init(void) {
set_tris_b((*0xF93 & 0xFB ) | 0x08); //b3 is out, b2 is in
In the 18F6680, CANTX1 is on pin G0 (CANTX2 is not normally used) and
CANRX is on G2, so change it to this:
Code:
set_tris_g((*0xF98 & 0xFE ) | 0x04); // Pin G0 is out, G2 is input
Create copies of the can-18F4580.c and .h files and rename them to
can-18F6680.c and can-18F6680.h and do any edits in those files.
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