Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.
Hi,
Thanks again for your help Klaus.
I have a few questions about the above method of extracting the mWh value. If I understood it correctly the shifting of the LSB is only for the reason so that we can fit it in a 16 bit value is that correct? If so lets take the example of Reactive energy...
Hi,
Thanks again for the response.
Okay if I understood you correctly, I should be doing something as follows:
#define MW_MUL (1000 * 32765 / 65536)
uint32_t energy = 0;
uint32_t integral = 0;
int32_t fractional = 0;
energy = (integral * 1000) + ((fractional * MW_MUL) >> 16);
Let me...
Hi thanks again for the explanation.
While doing a 16x16 multiplication you have used 32765.5 which is a float value would this cause undefined behaviour while calculating?
Secondly, Please see below calculation let me know if I have understood it correctly:
uint32_t energy = 0;
uint32_t...
Hi Klaus,
Thanks for the response.
I am in fact something similar to what you explained here. I am reading the counter 4 times in a second and then keeping then checking the delta between new count and old count. Then I add the delta to a signed integer since energy direction could be negative...
The reason is the speed.
I am using SAMD21 from Atmel and the development tool is Atmel Studio.
Can you please elaborate your suggestion above of using fixed point types and math routines?
Best regards.
Thank for your response.
I have in fact successfully read the energy counters and made some calibration to adjust the reading.
I am having trouble with accumulation of the energy, since the counters roll over every time they reach maximum and therefore they have to be read at least once in a...
Hello everyone,
I am working on a project which involves metering. For this purpose I am using single phase energy metering chip STPM10 from STMicroelectronics. I have successfully interfaced it with the microcontroller via SPI interface and I can read the Vrms Irms and Line Frequency by...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.