Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/16/10 08:12
Modified:
  06/16/10 08:20

Read: times


 
#176706 - Simplest Solution?
Responding to: ???'s previous message
Hi David,

Thanks for your helpful suggestions.

Yes, I started out with a related solution, where I simply use a generic SFR declaration header file that doesn't have the CKCON declaration, and I then just add my own declaration to the module that requires it. As you and Andy have both pointed out, it's not a perfect solution, as there remains the possibility that the target device locates it's own CKCON SFR elsewhere. I became a little wary of going this route, as it introduces the prospect of 'silent failure' in cases where the target architecture is actually different, and where the end user is unaware of said occurrence.

After mulling over some of the other thought provoking suggestions I received, I decided to go with a fairly simple solution, but one that relies heavily on the user having read the manual. The most user friendly solution I could devise was simply to rename the CKCON SFR register with a pre-compiler define statement, and ask the user to uncomment this re-definition as required, and where compilation will otherwise fail noticeably.

#if (SIO_POLL_X2_MODE == 1)
  /** 
   * Clock control special function register name redefinition.
   * Uncomment this redefinition for the original CKCON clock
   * control register in circumstances where your device-specific
   * SFR register declaration header file inconveniently renames
   * it as CKCON0.
   * hideinitializer
   */
//  #define CKCON                   CKCON0
#endif

 

That's probably not the best way to go, and I am certainly still open to further comments. I saw it as a fairly readily understandable work-around, however, so thought it an appropriately user-friendly fix for my unique coding situation.

Regards,
Murray R. Van Luyn.

List of 34 messages in thread
TopicAuthorDate
Conditional SFR Declaration?            01/01/70 00:00      
   ReDef            01/01/70 00:00      
   Preprocessor -vs- Compiler            01/01/70 00:00      
      Thanks...            01/01/70 00:00      
   A Loosely Related Query?            01/01/70 00:00      
      .h file            01/01/70 00:00      
         Yep, that works!            01/01/70 00:00      
            I would not            01/01/70 00:00      
               Good question...            01/01/70 00:00      
            A Rethink...            01/01/70 00:00      
               I don't know ... but            01/01/70 00:00      
                  Agree with Michael            01/01/70 00:00      
                  An overthink.            01/01/70 00:00      
               #including #includes            01/01/70 00:00      
                  totally?            01/01/70 00:00      
                     re: really?            01/01/70 00:00      
   Still no luck...            01/01/70 00:00      
      Like I said before....            01/01/70 00:00      
      HAL            01/01/70 00:00      
      just curious            01/01/70 00:00      
         Nicely workable solution found...            01/01/70 00:00      
            Post vandalised!            01/01/70 00:00      
               What do you mean ...            01/01/70 00:00      
                  I mean this...            01/01/70 00:00      
                     Vandalism Highly Doubted            01/01/70 00:00      
                        Thanks Michael.            01/01/70 00:00      
      Define a new sfr?            01/01/70 00:00      
         RE: This assumes that location 0x8E is always the register            01/01/70 00:00      
         Simplest Solution?            01/01/70 00:00      
            I think HAL is less risky?            01/01/70 00:00      
               HAL very interesting...            01/01/70 00:00      
                  RE: might not be so immediately well understood            01/01/70 00:00      
                     Ah, now I see...            01/01/70 00:00      
                        No, you don't need a HAL header file for each variant!            01/01/70 00:00      

Back to Subject List