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

Need Help

If I execute an instruction: MOV PSW, #07DH what is the active register bank? I believe its bank 2.

Parents
  • In assembler, you can write constants in binary.
    (Aside: for this very reason, it's a real pain that 'C' doesn't provide a binary notation for constants!)


    I'm using "modified binary" for C
    an example (SILabs f12x:

    the .h looks like for SCON
    sfr S0_SCON0            = 0x98;    // UART 0 CONTROL
      sbit    SB0_SCON0_SM0   = 0x9F;
      sbit    SB0_SCON0_SM1   = 0x9E;
      sbit    SB0_SCON0_SM2   = 0x9D;
      sbit    SB0_SCON0_REN   = 0x9C;
      sbit    SB0_SCON0_TB8   = 0x9B;
      sbit    SB0_SCON0_RB8   = 0x9A;
      sbit    SB0_SCON0_TI    = 0x99;
      sbit    SB0_SCON0_RI    = 0x98;
      #define SM_SCON0_SM0      0x80
      #define SM_SCON0_SM1      0x40
      #define SM_SCON0_SM2      0x20
      #define SM_SCON0_REN      0x10
      #define SM_SCON0_TB8      0x08
      #define SM_SCON0_RB8      0x04
      #define SM_SCON0_TI       0x02
      #define SM_SCON0_RI       0x01
    
    The initialization then looks like
    
      S0_SCON0  = 0 + SM_SCON0_SM0 + SM_SCON0_SM1                + SM_SCON0_REN;
    and is crystal clear
    
    Erik
    
    PS the added characters have purposes irrelevant to the "pseudo binary"
    

Reply
  • In assembler, you can write constants in binary.
    (Aside: for this very reason, it's a real pain that 'C' doesn't provide a binary notation for constants!)


    I'm using "modified binary" for C
    an example (SILabs f12x:

    the .h looks like for SCON
    sfr S0_SCON0            = 0x98;    // UART 0 CONTROL
      sbit    SB0_SCON0_SM0   = 0x9F;
      sbit    SB0_SCON0_SM1   = 0x9E;
      sbit    SB0_SCON0_SM2   = 0x9D;
      sbit    SB0_SCON0_REN   = 0x9C;
      sbit    SB0_SCON0_TB8   = 0x9B;
      sbit    SB0_SCON0_RB8   = 0x9A;
      sbit    SB0_SCON0_TI    = 0x99;
      sbit    SB0_SCON0_RI    = 0x98;
      #define SM_SCON0_SM0      0x80
      #define SM_SCON0_SM1      0x40
      #define SM_SCON0_SM2      0x20
      #define SM_SCON0_REN      0x10
      #define SM_SCON0_TB8      0x08
      #define SM_SCON0_RB8      0x04
      #define SM_SCON0_TI       0x02
      #define SM_SCON0_RI       0x01
    
    The initialization then looks like
    
      S0_SCON0  = 0 + SM_SCON0_SM0 + SM_SCON0_SM1                + SM_SCON0_REN;
    and is crystal clear
    
    Erik
    
    PS the added characters have purposes irrelevant to the "pseudo binary"
    

Children
No data