This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

multiple REG51.H includes

Hello, I'm new in KEIL sw. As I can see I can include REG51.h file in only one C or ASM file in the whole project... is that possible?

Best regards,
Branislava

Parents
  • In a "normal" 'C' project, you would expect to find things like stdio.h included in many places throughout the Project; similarly, in a C51 project, you would expect to find many (most?) of the files including the appropriate version of reg51.h.

    Like stdio.h, reg51.h simply provides information about the external system - this is the purpose of header files.

    Where it all goes wrong is when people put variable or function definitions in headers, so that the header actually starts consuming system resources.
    Variables and functions must be defined in exactly one Source ('C' or ASM) or Library module; external declarations may then be placed in header file(s) to be included in as many modules as required.

Reply
  • In a "normal" 'C' project, you would expect to find things like stdio.h included in many places throughout the Project; similarly, in a C51 project, you would expect to find many (most?) of the files including the appropriate version of reg51.h.

    Like stdio.h, reg51.h simply provides information about the external system - this is the purpose of header files.

    Where it all goes wrong is when people put variable or function definitions in headers, so that the header actually starts consuming system resources.
    Variables and functions must be defined in exactly one Source ('C' or ASM) or Library module; external declarations may then be placed in header file(s) to be included in as many modules as required.

Children
No data