Post Go back to editing

"AD5940_WriteReg(REG_AFE_SWMUX, 1<< 1) " is Valid?

HI.

I have a question about some code in BATImpedance.cpp.

------------------------

AD5940_WriteReg(REG_AFE_SWMUX, 0);

or 

AD5940_WriteReg(REG_AFE_SWMUX, 1<< 1);

-----------------------

In the datasheet REG_AFE_SWMUX  (0x0000235C)

[2:0] reserved ,  3 only avaiable. 

Would you show me why 0 or 1 was used instead of 1<<3 ?

Parents
  • Hi,

    In the block diagram below:

    AIN2 measures RCAL impedance.

    AIN3 measures Battery impedance.

    REG_AFE_SWMUX[2:0] = 001; //enable common mode switch on AIN3

    REG_AFE_SWMUX[2:0] = 000; //enable common mode switch on AIN2

    REG_AFE_SWMUX[2:0] = 010; //disable common mode switch on both AIN2 and AIN3

  • Thank you for your kind and detailed reply.
    But there are still some things I don't understand.
    There are defined like this. 

    #define REG_AFE_SWMUX 0x0000235C                    /*  AFE Switch Mux for ECG */
    And look at the datasheet, 





    REG_AFE_SWMUX[2:0] : Reserved.
    How should I understand this part?
     
  • Hi,

    Keeping [2:0] = 0x0 enable or disables both AIN2 and AIN3 common mode voltages. 

    Since this is the use case for most of the applications, they are kept 0x0.

    Though they are reserved, they can be R/W.

    These bits[2:0] can be used for individually enabling AIN2 or AIN3 CM.

Reply
  • Hi,

    Keeping [2:0] = 0x0 enable or disables both AIN2 and AIN3 common mode voltages. 

    Since this is the use case for most of the applications, they are kept 0x0.

    Though they are reserved, they can be R/W.

    These bits[2:0] can be used for individually enabling AIN2 or AIN3 CM.

Children