SDCC bug or insanity?

Help
robert
2008-12-18
2013-03-12
  • robert
    robert
    2008-12-18

    I am not sure what I might have done wrong, so if you have any ideas, let me know, before I submit this as a bug.

    Source:
    #define    OFF        0x00
    SBIT(WDTE,0xD9,0x6);
    WDTE = OFF;

    Assembly:
    CLR D8.7

    I looked for redefinitions of the variable, and even changed the variable name with the same result.  All of my other SBITs seem correct so far.

     
    • Patryk
      Patryk
      2008-12-19

      Register at 0xD9 (PCA0MD if it's SiLabs chip) is not bit addressable - only every eighth SFR is (at 0x80, 0x88, 0x90, 0x98 etc.). You need to
      #define WDTE 0x40
      and then use it like that:
      PCA0MD &= !WDTE // clear
      PCA0MD |= WDTE // set

       
      • There's a typo ('!' versus '~'). Should be 'bitwise not':

        PCA0MD &= ~WDTE; // clear

         
        • Patryk
          Patryk
          2008-12-19

          Sorry, my fault! :-)

           
    • robert
      robert
      2008-12-19

      Hey great thnx!  I was starting to think that would be the case as I tried embedding ASM and it addressed something else completely. I looked through the SiLabs document for my chip though and could not find the bit/byte addressable info for D9.

      Oh - wait some graph is coming to mind now - let me see if I can find that one.