|
|
View previous topic :: View next topic |
Author |
Message |
kgng97ccs
Joined: 02 Apr 2022 Posts: 97
|
Using the PIC18F46K22 registers file from CCS |
Posted: Thu May 19, 2022 12:49 am |
|
|
I am using the PIC18LF46K22, CCS C Compiler v5.078, and MPLAB IDE v8.92.
I wanted to try to include the registers file for PIC18F46K22 generated from within the CCS IDE (via the Device Table Editor), to make sure I can include it correctly if I need to use it.
The following two header files are in a subdirectory of the directory where the main file is:
Code: | #include "18LF46K22.h"
#include "PIC18F46K22_registers.h" |
I have no problem with #include "18LF46K22.h", but got this error for #include "PIC18F46K22_registers.h" (Line 12):
*** Error 18 "main_N892_v1.0.c" Line 12(10,35): File can not be opened
Not in source "PIC18F46K22_registers.h"
Not in local "PIC18F46K22_registers.h"
Not in project "F:\A\_Data1\Programming\SMN-892_PIC code_MPLAB892\PIC18F46K22_registers.h"
Not in "C:\Program Files (x86)\PICC\devices\PIC18F46K22_registers.h"
Not in "C:\Program Files (x86)\PICC\drivers\PIC18F46K22_registers.h"
Is there something that I missed? |
|
|
hmmpic
Joined: 09 Mar 2010 Posts: 314 Location: Denmark
|
|
Posted: Thu May 19, 2022 1:12 am |
|
|
Tell the compiler where the dir is as:
#include "./x/subdir-test.h" |
|
|
kgng97ccs
Joined: 02 Apr 2022 Posts: 97
|
|
Posted: Thu May 19, 2022 1:33 am |
|
|
1. I did that, and it seems that the program is now able to read it.
Code: | #include "18LF46K22.h"
#include "./include/PIC18F46K22_registers.h" |
But I did not have to do that (indicate the subdirectory) for the first header file ("18LF46K22.h"). Is there any explanation for this?
2. I got new errors:
>>> Warning 238 "F:\A\_Data1\Programming\SMN-892_PIC code_MPLAB892\include\PIC18F46K22_registers.h" Line 10(2,5): Duplicate #locate
>>> Warning 238 "F:\A\_Data1\Programming\SMN-892_PIC code_MPLAB892\include\PIC18F46K22_registers.h" Line 28(2,5): Duplicate #locate
>>> Warning 238 "F:\A\_Data1\Programming\SMN-892_PIC code_MPLAB892\include\PIC18F46K22_registers.h" Line 37(2,5): Duplicate #locate
>>> Warning 238 "F:\A\_Data1\Programming\SMN-892_PIC code_MPLAB892\include\PIC18F46K22_registers.h" Line 58(2,5): Duplicate #locate
... (many similar #locate errors)
--- Info 300 "F:\A\_Data1\Programming\SMN-892_PIC code_MPLAB892\include\PIC18F46K22_registers.h" Line 336(2,5): More info: First Declaration of MCU_TX9D
*** Error 31 "F:\A\_Data1\Programming\SMN-892_PIC code_MPLAB892\include\PIC18F46K22_registers.h" Line 582(2,5): Identifier is already used in this scope
*** Error 48 "F:\A\_Data1\Programming\SMN-892_PIC code_MPLAB892\include\PIC18F46K22_registers.h" Line 582(9,17): Expecting a (
*** Error 48 "F:\A\_Data1\Programming\SMN-892_PIC code_MPLAB892\include\PIC18F46K22_registers.h" Line 582(20,30): Expecting a (
--- Info 300 "F:\A\_Data1\Programming\SMN-892_PIC code_MPLAB892\include\PIC18F46K22_registers.h" Line 338(2,5): More info: First Declaration of MCU_BRGH
*** Error 31 "F:\A\_Data1\Programming\SMN-892_PIC code_MPLAB892\include\PIC18F46K22_registers.h" Line 584(2,5): Identifier is already used in this scope
*** Error 48 "F:\A\_Data1\Programming\SMN-892_PIC code_MPLAB892\include\PIC18F46K22_registers.h" Line 584(9,18): Expecting a (
*** Error 48 "F:\A\_Data1\Programming\SMN-892_PIC code_MPLAB892\include\PIC18F46K22_registers.h" Line 584(21,31): Expecting a (
... (many similar sets of errors)
Can the CCS-generated registers file (as it is) co-exist with the standard device header file? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Thu May 19, 2022 2:51 am |
|
|
The reason you did not have to put the full path for the device file, is that
the compiler when installed automatically adds the location of this to the
computer's 'PATH' variable, where it automatically searches for things.
For everything that is not in these default locations, the full path is needed.
The #locate messages are _warnings_, not 'errors'. Very significant difference.
The reason for these is that CCS have added some of the registers to the
device header. They started doing this a while ago, for things like the
timers etc..
The other problem is there is a fault in the generated file for your chip....
What they have done is generated duplicate bits for the second UART with
the same names as for the first UART.
So, at line 577, they have:
#bit MCU_TX9D = MCU_TXSTA2.0
etc. etc..
What you need to do, is when generating the file select the option
'Add byte name to prefix'. This prevents this from happening by
giving the same bits for different UART's different names.
This will also prevent the warnings, since this makes the names different
from the ones in the default include file. |
|
|
kgng97ccs
Joined: 02 Apr 2022 Posts: 97
|
|
Posted: Thu May 19, 2022 4:44 am |
|
|
Thank you so much, Ttelmah. I would never have thought I need to select that option. Yes, I now notice the byte name is added to each #bit ID so that the ID is unique.
I used the new registers file, but still get a number of #locate warnings (41 in total):
>>> Warning 238 "F:\A\_Data1\Programming\SMN-892_PIC code_MPLAB892\include\PIC18F46K22_registers.h" Line 6(2,5): Duplicate #locate
>>> Warning 238 "F:\A\_Data1\Programming\SMN-892_PIC code_MPLAB892\include\PIC18F46K22_registers.h" Line 24(2,5): Duplicate #locate
>>> Warning 238 "F:\A\_Data1\Programming\SMN-892_PIC code_MPLAB892\include\PIC18F46K22_registers.h" Line 33(2,5): Duplicate #locate
>>> Warning 238 "F:\A\_Data1\Programming\SMN-892_PIC code_MPLAB892\include\PIC18F46K22_registers.h" Line 54(2,5): Duplicate #locate
>>> Warning 238 "F:\A\_Data1\Programming\SMN-892_PIC code_MPLAB892\include\PIC18F46K22_registers.h" Line 106(2,5): Duplicate #locate
>>> Warning 238 "F:\A\_Data1\Programming\SMN-892_PIC code_MPLAB892\include\PIC18F46K22_registers.h" Line 118(2,5): Duplicate #locate
...
I tried but could not quite figure out where the duplicate #locate occurred.
Should I just ignore these warnings? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Thu May 19, 2022 6:08 am |
|
|
Yes,
It is caused because it gives the same bits multiple names in some places.
So (for example):
#bit MCU_ECCP3AS_P3SSBD0 = MCU_ECCP3AS.0 //line 743
#bit MCU_ECCP3AS_PSS3BD0 = MCU_ECCP3AS.0 //line 752
Both are for the same physical bit, so it warns you.
Doesn't matter at all.
Totally up to you which name to use. |
|
|
kgng97ccs
Joined: 02 Apr 2022 Posts: 97
|
|
Posted: Sat May 21, 2022 8:15 am |
|
|
Thank you, Ttelmah. |
|
|
|
|
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
|