AnsweredAssumed Answered

ADE7763 Trying to zero the offset registers

Question asked by james1111 on Feb 2, 2016
Latest reply on Feb 5, 2016 by hmani

Hi there,

 

I have my project mostly working however when there is no voltage on CH1 for IRMS I get some channels (I have 8) read like 1.2 & 3.7A and I would like to zero these, if I set the register CH1OS to 0x00 at first initialization it makes no difference.

 

Where I do my regular V & I read, 

 

  • I config the chip for IRMS,
  • set the register CH1OS to 0x00 &
  • read the IRMS

 

This is now reading low, like 0.1A which is fine, however when I turn the mains voltage supply on I measure no V but 80 Amps, if I comment out the offset register write it ready V normally again, but the offset goes back to 1-4V

 

// ADE7763 definitions

#define READ_MODE_REG   0x09

#define WRITE_MODE_REG  0x89

#define CURRENT         0x58

#define VOLTAGE         0x78

#define SETTINGS        0xAD    // break out into seperate bits later on

#define SET_GAIN        0x8F

#define SET_I_OFFSET    0x0D

#define SET_V_OFFSET    0x0E

#define FULL_RANGE      0x00    // +/-500mV

#define IRMS            0x16

#define VRMS            0x17

#define FREQ            0x27   

#define TRUE            1

#define FALSE           0

#define DELAY_BETWEEN_READINGS 10

 

uint8_t config_ade7763_VRMS(uint8_t i)

{

    cs_low(i); 

    _delay_us(4);

    writeSPI1(WRITE_MODE_REG);  // 89

    _delay_us(30);

    writeSPI1(VOLTAGE);         // 78

    _delay_us(30);

    writeSPI1(SETTINGS);        // AD

    _delay_us(30);

    cs_high(i); 

    _delay_us(DELAY_BETWEEN_READINGS);

}

 

uint8_t config_ade7763_IRMS(uint8_t i)

{

    cs_low(i); 

    _delay_us(4);

    writeSPI1(WRITE_MODE_REG);

    _delay_us(30);

    writeSPI1(CURRENT);

    _delay_us(30);

    writeSPI1(SETTINGS);

    _delay_us(30);

    cs_high(i); 

    _delay_us(DELAY_BETWEEN_READINGS);

    return TRUE;

}

 

uint8_t config_ade7763_Voffset(uint8_t i)

{

    cs_low(i); 

    _delay_us(4);

    writeSPI1(WRITE_MODE_REG); 

    _delay_us(30);

    writeSPI1(SET_V_OFFSET);       

    _delay_us(30);

    writeSPI1(0x00);            // zero the current offset in ch 2

    _delay_us(30);

    cs_high(i);

    _delay_us(DELAY_BETWEEN_READINGS);

}

 

uint8_t config_ade7763_Ioffset(uint8_t i)

{

    cs_low(i); 

    _delay_us(4);

    writeSPI1(WRITE_MODE_REG); 

    _delay_us(30);

    writeSPI1(SET_I_OFFSET);       

    _delay_us(30);

    writeSPI1(0x00);                // zero the current offset in ch 1

    _delay_us(30);

    cs_high(i);

    _delay_us(DELAY_BETWEEN_READINGS);

}

 

uint8_t config_ade7763_range(uint8_t i)

{

    cs_low(i); 

    _delay_us(4);

    writeSPI1(SET_GAIN);    // 8F

    _delay_us(5);         

    writeSPI1(FULL_RANGE);  // 00   

    _delay_us(15);

    cs_high(i); 

    _delay_us(DELAY_BETWEEN_READINGS);

}

 

void ade7763_init(void)

{

    uint8_t i=0;

 

    for( i=0; i<8; i++)

    {  

        config_ade7763_VRMS(i);

        _delay_ms(1);

//        config_ade7763_Voffset(i);

        _delay_ms(1);

        config_ade7763_range(i);

        _delay_ms(1);

        config_ade7763_IRMS(i);

        _delay_ms(1);

        config_ade7763_Ioffset(i);

        _delay_ms(1);

        config_ade7763_range(i);

        _delay_ms(1);

    }  

}

 

for( v=0; v<4; v++)

{  

     config_ade7763_VRMS(v);  

     config_ade7763_range(v); 

     config_ade7763_Voffset(v); 

     read_ade7763_VRMS(v);    

}

for( i=0; i<4; i++)

{  

     config_ade7763_IRMS(i);        

     config_ade7763_Ioffset(i);  

     config_ade7763_range(i);          

     read_ade7763_IRMS(i);                  

}

 

Any ideas why this is happening please?

Thanks in advance..

Outcomes