AnsweredAssumed Answered

problem with reading ADE7753 registers

Question asked by Leonard30 on Apr 24, 2015
Latest reply on Nov 10, 2017 by baxter

Hi all

I 'm developing a power meter as the final project of college using a PIC18f45550 microcontroller and integrated meter ADE7753 , but so far I 've had success when trying to read the VRMS register. I always get back the 0xFF values for bytes MSB , MID and LSB

Any help will be welcome !

The code is below

 

Greetings

Leonardo

 

 

//*******FUNÇÃO: LEITURA DE REGISTRADOR ********************************\

 

// Nome da Função: LER_REG_ADE7753

// Entrada: numero do registrador

// Saída: conteúdo do registrador

 

//*********************************************************************************************

 

      unsigned short long LER_REG_24_BITS_ADE7753(unsigned char registrador){

     

           unsigned short long dado1, dado2, dado3 = 0;

      char dummy;

 

      chip_select = 0;             

      SSPBUF=registrador;

     

      Delay10TCYx(1); //gera um atraso de T = 10*1*1 = 10 us    

     

      MSB = SSPBUF; // Salva o byte MSB

 

     

           MID = SSPBUF; // Salva o byte MID

 

     

      LSB = SSPBUF; // Salva o byte LSB

     

      chip_select = 1;

     

 

      reg_LIDO = MSB;      

      dado1 = reg_LIDO << 16;

    

      reg_LIDO = MID;       

      dado2 = reg_LIDO << 8;

      dado3 = LSB;

                 

      dado = dado1 + dado2 + dado3;

      return dado;

 

      }

Outcomes