CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

CAN BUS & PIC18F248

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Animok



Joined: 03 May 2018
Posts: 11

View user's profile Send private message

CAN BUS & PIC18F248
PostPosted: Thu Nov 08, 2018 1:23 pm     Reply with quote

Hello everyone.

A simple question:

Can I use EX_J1939.c with PIC18F248?

This example refer to PIC18F4580.h why?

Regards
Ttelmah



Joined: 11 Mar 2010
Posts: 19546

View user's profile Send private message

PostPosted: Fri Nov 09, 2018 1:31 am     Reply with quote

Potentially with a bit of tweaking. Obviously you have to setup the clock and fuses etc., to match.

Key is in the PIC18 can driver (can-18F4580.c), where it carefully says:
Quote:

CAN Library routines for Microchip's PIC18Cxx8 and 18Fxx8 line


The 248, has the 'standard' CAN peripheral, not the ECAN peripheral, but the driver supports a 'legacy' mode to support this.

Problem comes in j1939.c, where there is the section:
Code:

    #else //PIC18
      can_set_mode(CAN_OP_CONFIG);  //put CAN in Config mode
     
      can_set_functional_mode(CAN_FUN_OP_ENHANCED_FIFO);


You'll have to change this to CAN_FUN_OP_LEGACY.
The driver can work with this, since it is used if running with an external chip. So it ought then to run....
Animok



Joined: 03 May 2018
Posts: 11

View user's profile Send private message

PostPosted: Fri Nov 09, 2018 3:06 am     Reply with quote

Thanks Ttelmah.

I wil try it.
However, what about PIC18F25K80 ?
It have ECAN, is it better option?

Regards
Ttelmah



Joined: 11 Mar 2010
Posts: 19546

View user's profile Send private message

PostPosted: Fri Nov 09, 2018 5:00 am     Reply with quote

Yes. With the fuses set right that is directly compatible.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group