The ADE7816 does not have individual energy accumulation registers for both import and export but rather a single accumulation register that accumulates both. This means that if over a fixed time span if half of that time is import, the other half is export for exactly the same power level then the register itself will come out as zero because it is a signed accumulation.
The way to separate out import and export is to use the REVAP and REVRP interrupts and perform the accumulation of separate import and export energy on the MCU.
Using the CHSIGN register the sign of all the powers on 3 of the channels can be checked and the CHANNEL_SEL bit in COMPMODE can be used to check the other channels. Then the REVx bits in STATUS0 register can be used to alert the system when the sign has changed.
The process would go something like this:
- Check the sign of the power by reading CHSIGN
- Read Energy as normal and place in either import or export bucket in the MCU
- When REVx triggers in the STATUS0 (can be monitored with IRQ0 using the MASK0 bits), then use that information to read the appropriate energy register with reset to clear them out a start a new accumulation
- Read xWATTHR and xVARHR registers
If you want to do this on 3 of the 6 channels then it isn’t too bad to manage, if you want to do it on all 6 channels then you will need to use the CHANNEL_SEL bit in COMPMODE to get all the information. This would mean periodically modifying the CHANNEL_SEL bit to be able to get the REVx interrupt on all 6 channels.