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 support@ccsinfo.com

Problem with LIN communication

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



Joined: 16 Feb 2018
Posts: 7
Location: Pune

View user's profile Send private message Send e-mail

Problem with LIN communication
PostPosted: Fri Feb 16, 2018 5:03 am     Reply with quote

hello everyone,

I'm going to learn LIN protocol for that i use uc PIC18f46k22 and LIN driver ic
MCP2021 and CCS PCH v5.008. I find LIN Bus sample example of PIC16F687/89/90 in CCS PCH v5.008 but i change this PIC16 uc to PIC18f46k22 in sample code by taking care of configuration bits and Register.
code was build in software successfully but does not work in proteus simulation(only get break field on DSO) and Hardware also Sad

what i want to change further in code for PIC18f46k22

Please help me I'm tried lots of thing to get output Sad

Thanks in advance
temtronic



Joined: 01 Jul 2010
Posts: 6327
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Feb 16, 2018 6:25 am     Reply with quote

While I've never used LIN, I had a quick look at the CCS drivers, I do use the 46K22 and have the following comments.

1) It is highly improbable that Proteus will simulate a PIC18F46K22 and MCP2021, so don't waste your time.

2) Buy 2 of the PIC16F690 and bench test. The LIN drivers( master and slave) should work fine. Once this hardware configuration is 100% THEN proceed to the 46K22 PICs.

3) bench test the 46K22. 1st test should be a '1Hz LED' program. This will confirm your hardware(PIC + parts), compiler and programmer do function correctly. 2nd test will be a PC interface, aka serial using the HW UART of the PIC. This will confirm you CAN communicate to a PC. These days PCs only have USB ports, so you'll need a TTL<>USB module.

4) NOW you can copy the LIN drivers,name them 46K22_LIN_MASTER , 46K22_LIN_SLAVE and then edit this file. Do NOT edit the original CCS LIN drivers !! As you've discovered there are a LOT of registers that need to be renamed,so be careful, comment EVERY line you change or add !!

5) connect the 46K22 MASTER to the 690 SLAVE and test. Since the slave worked in #2 above, any failure is due to the 'MASTER' program. Edit as required to make it work.

6) Now that the 46K22 MASTER is working, edit the 46K22 SLAVE code, connect to 46K22 MASTER and test.

this series of steps should get your 46K22 LIN project working fairly fast.
You need to start with KNOWN working code AND hardware, and logically build upon them.

Jay
PCM programmer



Joined: 06 Sep 2003
Posts: 20421

View user's profile Send private message

PostPosted: Fri Feb 16, 2018 7:04 am     Reply with quote

You posted your code in a PM to me. You should post it here.

But anyway, one big problem is this line:
Code:
#FUSES XINST //Extended set extension and Indexed Addressing mode enabled

CCS does not support this mode. Change the fuse to NOXINST.
HARSHAL KHAJONE



Joined: 16 Feb 2018
Posts: 7
Location: Pune

View user's profile Send private message Send e-mail

Problem with LIN communication
PostPosted: Fri Feb 16, 2018 8:34 am     Reply with quote

temtronic
Quote:


thanks temtronic for your valuable advice Smile
I'll try by giving your step by step procedure

[/list]
HARSHAL KHAJONE



Joined: 16 Feb 2018
Posts: 7
Location: Pune

View user's profile Send private message Send e-mail

PostPosted: Fri Feb 16, 2018 8:51 am     Reply with quote

PCM programmer wrote:
You posted your code in a PM to me. You should post it here.

But anyway, one big problem is this line:
Code:
#FUSES XINST //Extended set extension and Indexed Addressing mode enabled

CCS does not support this mode. Change the fuse to NOXINST.


thanks for reply...

I changed NOXINST fuse but output get as it is.

i seen at DSO Header frame of master send properly but slave does not respond to the master, I observed at slave side there is RC1IF does not get set. I also observed there is getc(); & while(!RC1IF) does not working...

please help me...

Thank you..
temtronic



Joined: 01 Jul 2010
Posts: 6327
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Feb 16, 2018 9:05 am     Reply with quote

obvious question but which HW UART are you using for the slave ?
HARSHAL KHAJONE



Joined: 16 Feb 2018
Posts: 7
Location: Pune

View user's profile Send private message Send e-mail

PostPosted: Fri Feb 16, 2018 9:11 am     Reply with quote

temtronic wrote:
obvious question but which HW UART are you using for the slave ?



HW UART1
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