|
|
View previous topic :: View next topic |
Author |
Message |
maj81uk
Joined: 27 Jan 2004 Posts: 4 Location: UK
|
Problems compiling can-mcp2510.c with the header file |
Posted: Mon Mar 01, 2004 7:19 pm |
|
|
I have used ex_can_ccs_b.c, with some minor changes to act as code for my PIC, within a Controller Area Network. The project contains four files; ex_can_ccs_b.c, can-mcp2510.c, can-mcp2510.h and 16F628A.h.
When compiling the project an error is displayed 'Error 128 "C:\PROGRA~1\PICC\drivers\can-mcp2510.h" Line 75(1,2): A #DEVICE required before this line'.
Line 75 consists of 'enum CAN_OP_MODE {CAN_OP_CONFIG=4, CAN_OP_LISTEN=3, CAN_OP_LOOPBACK=2, CAN_OP_SLEEP=1, CAN_OP_NORMAL=0};'.
Can anyone explain the reason for the error, considering that the code is written by ccs themselves, and maybe a possible solution? The changes I have implemented should have no effect on the CAN-MCP2510 (microcontroller) functionality.
Many thanks
Maj |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Mar 01, 2004 9:53 pm |
|
|
Quote: | I have used ex_can_ccs_b.c, with some minor changes to act as
code for my PIC, within a Controller Area Network |
What happens if you try to compile the file, with no changes ?
I tried this, just now. It worked OK. I used MPLAB vs. 6.42,
and used Project Wizard to create a project, and added the
ex_can_ccs_b.c file to the project. Initially it gave me an
error regarding the device, so I went the MPLAB "Configure"
menu and then to "Select Device", and picked 16F876.
Then I compiled it and it gave only one minor warning.
("Condition always true"). This was done with PCM vs. 3.184.
Quote: | The project contains four files; ex_can_ccs_b.c, can-mcp2510.c,
can-mcp2510.h and 16F628A.h. |
In my Project Window in MPLAB, it lists these files:
Source Files:
ex_can_ccs_b.c
Header Files:
16F876.h
can-mcp2510.h
I think you should set your project up the same way, and then
try to re-compile. |
|
|
maj81uk
Joined: 27 Jan 2004 Posts: 4 Location: UK
|
Questions |
Posted: Wed Mar 03, 2004 1:58 pm |
|
|
Thanks for the help, I was able to compile the project after those changes. But have a couple of questions to ask.
1) Why do I have to remove the can-mcp2510.c from the project to compile it? I can't see how it can work without that file, yet it appears in the list file? Where does it retrieve this file from once compiling?
2) Concerning this matter, I am using the PIC16F628 and therefore made some changes to the can-mcp2510.c, that if it isn't included, will not me mapped through to the compiled software. Is there anyway to get around this?
So basically could you justify the changes to the project in order to compile it? Any help is much appreciated. Thanks again.
Maj |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Mar 03, 2004 2:18 pm |
|
|
MPLAB is designed for assemblers or compilers that have a linker.
CCS does not have a linker.
If you look at line 40 of the EX_CAN_CCS_B.C file, you will see this line:
#include <can-mcp2510.c>
That is how the file is "added" to the CCS project.
So the answer is, just add your main C source file to the MPLAB
project. "Add" all other files by using #include statements. |
|
|
|
|
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
|