Hi to All
I have probably find the problem. It comes when differential inputs sampling is added. In ATmega32U4 datasheet is written that the conversion takes 13 clocks for single ended input conversion but 14 for differential. On the other hand there is additional time for synchronization up to 3 clock cycles. All these details and the fact that in used by me sequence the scanned inputs are 6 single ended and 8 differential probably effective ADCDuration should be something different from 104us (@13 clocks) and 112us (@13 clocks) . That is why I investigate firmware behavior for different integer values of ADCDuration. The measured mains frequency vs ADCDuration value is shown on the following picture:
As a result if ADCDuration = 117 is chosen the measured figures become like expected:
{ Va: 225.23, Hz: 49.796, Sp: 1,
Ia: [ 64.327, 16.052, 16.050, 16.058, 16.056, 16.084, 16.084, 16.080, 16.079, 16.097, 16.087, 16.081, 16.079 ],
PF: [ 0.9974, 0.9956, 0.9955, 0.9954, 0.9952, 0.9972, 0.9972, 0.9973, 0.9973, 0.9973, 0.9973, 0.9973, 0.9973 ],
Wr: [ 14451, 3599, 3599, 3600, 3599, 3612, 3612, 3612, 3612, 3616, 3614, 3612, 3612 ],
Wa: [ 14488, 3615, 3615, 3617, 3616, 3623, 3622, 3622, 3621, 3626, 3623, 3622, 3621 ],
Wh: [ 177, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44 ],
}
Is that solves the problem with wrong calculated figures in a right way?
Regards
Chris