for coding questions please always tell us
* your complier
* your IDE
* the target microcontroller
***
Every statement needs to be defined somewhere.
Thus my question:
Where in your case is "PORTCbits" defined?
Example:
Maybe "PORTCbits" is efined in STD_IO.h.
Then add the line: "#include "STD_IO.h"
at the top of your code file. (Exact syntax depends on IDE and compiler)
for coding questions please always tell us
* your complier
* your IDE
* the target microcontroller
***
Every statement needs to be defined somewhere.
Thus my question:
Where in your case is "PORTCbits" defined?
Example:
Maybe "PORTCbits" is efined in STD_IO.h.
Then add the line: "#include "STD_IO.h"
at the top of your code file. (Exact syntax depends on IDE and compiler)
for coding questions please always tell us
* your complier
* your IDE
* the target microcontroller
***
Every statement needs to be defined somewhere.
Thus my question:
Where in your case is "PORTCbits" defined?
Example:
Maybe "PORTCbits" is efined in STD_IO.h.
Then add the line: "#include "STD_IO.h"
at the top of your code file. (Exact syntax depends on IDE and compiler)
My definitions are on main.c file. Then i have a RTC_ReadWriteEdit.c and RTC_ReadWriteEdit.h files. When i am using the say the ButtonPlus definition in RTC_ReadWriteEdit.c file the compiler comes up with the fault i describe on my main post.
Thanks
Each compiler has its own syntax for accessing special function registers, e.g. port bits. PORTCbits is no XC8 standard, it's defined in old C18 compiler. You can either switch to the SFR defines defined with XC8 by default (when including xc.h) or need to enable C18 support. Review the doc or Microchip XC8 support forum.
tyassin is right. I had already tried this way but didn't work and the reason was that i was included the .h file in the end of all the other includes. Should be in the very beginning.
Respectfully .. but you are wrong. I guess you mix "use" with "define".
* you defined "ButtonPlus" (this was not my question)
* you use "ButtonPlus" else where (Not my question)
* you used "PORTCbits" it in your C code (to define ButtomPlus). (not my question)
* but you never showed where "PORTCbits" is defined. This is what I was asking for
Respectfully .. but you are wrong. I guess you mix "use" with "define".
* you defined "ButtonPlus" (this was not my question)
* you use "ButtonPlus" else where (Not my question)
* you used "PORTCbits" it in your C code (to define ButtomPlus). (not my question)
* but you never showed where "PORTCbits" is defined. This is what I was asking for
Hi Klaus
i misread my bad sorry. Is in user.c. I enclose you the file to take a look. If you have something to add please do i will be grateful to learn one more thing.
You should add all these general port defines into a unique header file ( e.g: port.h ) and include it everywhere.
But all the port.h file content should be enclosed within a structure like this:
Code:
#ifndef PORT_H
#define PORT_H
// Port definitions here
#endif