??? 06/08/10 15:30 Read: times |
#176520 - Thanks... Responding to: ???'s previous message |
Thanks Andy & Michael. That all makes pretty good sense.
Yes, my concern in adding the CKCON definition to my module, centred about what happens when an end-user replaces the originally #included generic 80C31/ 80C51 register declaration header file. This file doesn't have the clock control register declaration, yet a more controller specific register declaration header file most likely will. The minute the register declaration header file is replaced, the compiler throws an unhappy CKCON register redefinition error. There turns out to be an embarrassingly simple solution to my dilemma. I simply declare the CKCON register in my module, conditionally on the presence of the original generic 80C31/ 80C51 register declaration header file's header guard define REG51_H in my project. As soon as the REG51.h file is replaced with something like AT89C51AC3.h, then the header guard declaration REG51_H disappears, and so does my previously superfluous CKCON register declaration. #ifdef REG51_H /* * Declare CKCON clock control register only if this module still #includes * it's original generic 8051 register declaration header file REG51.h. */ sfr CKCON = 0x8F; #endif Thanks for the valuable input, guy's. That's helped me to better understand the difference between pre-processor definitions and compiler declarations, as well as to make better use of header guard definitions. Cool! Regards, Murray R. Van Luyn. |