> Right now, I am starting by measuring the number of ticks in one second.
What's a tick? Can you be sure that the number of ticks per second is a constant?
> ... the result will be the number of ticks to increment one amp-hour.
Hmmm. So if the current is low you could be waiting a long time,
with lots of change during that time? Also, how many ticks does it take to
make a measurement? Do you add these ticks too?
> I think I'm running into a problem with the resolution after the
> multiplication, because the numbers are just so large
Without knowing your numbers, I can't tell. If you are using U32 that
gives you 0-4294967295. That is, 9 digits of resolution, max.
A DBL (aka Real 64) Gives somewhere around 15 digits
of r
esolution.
=================
But back to the original problem, rather than counting ticks to increment the
amp-hour counter, I would read the DMM as fast as is reasonable,
determine the time (in fraction of an hour) since the last reading,
multiply to determine incremental amp-hours, and add it to the previous total.
If your display can only handle integers, keep a fractional counter,
wait for it to get >= 1.000, then increment the integer counter and subtract 1.000 from the fractional counter.
Les.Hammer@CompleteTest.com