AnsweredAssumed Answered

LAENERGY register

Question asked by javiermendez on Sep 20, 2017
Latest reply on Oct 5, 2017 by javiermendez

this code is the correct way to use LAENERGY register with  LINECYC?

 

uint32_t ADE7753::zero_crossing(uint8_t register, flag)
{
      ResetStatus(); //     Clear all interrupts
      while(! ( GetStatus() & flag ) ) //wait for zero-crossing
       {

      }
      return ReadREG24(register); //
}

 

uint32_t ADE7753::get_Active_Power(void)
{
         uint32_t watt=0; 
         zero_crossing(LAENERGY,CYCEND); ///Ignore first reading to avoid garbage
         for (int i=0;i<100;i++)
         {
               watt+=zero_crossing(LAENERGY,CYCEND); //take 100 readings
         }
         return(LAENERGY/100); // send average

 

}

 

Is correct to take 100 reading to the LAENERGY/LVAENERGY/LVARENERGY register and send the average?

also could I use the same algorithm to AENERGY/RAENERGY and VAENERGY/RVAENERGY?

Outcomes