may be a bug in the MC workbench
Hello, in the code I generated using MC workbench 5 or 6, there is something wrong with the part of the code that calculates the phase current value.
You can easily find it by searching in the generated code
PHandle->PhaseAOffset >>= 3;
PHandle->PhaseBOffset >>= 3;
PHandle->PhaseCOffset >>= 3;
I feel that the 3 here is wrong, it should be 4
Because NB_CONVERSIONS is 16, that is, the PhaseAOffset, B, and C obtained by adding and summing the values measured 16 times. This can be seen from the following code
if ( pHandle->PolarizationCounter < NB_CONVERSIONS )
{
pHandle->PhaseAOffset += *pHandle->pParams_str->ADCDataReg1[pHandle->CalibSector];
pHandle->PhaseBOffset += *pHandle->pParams_str->ADCDataReg2[pHandle->CalibSector];
PHandle->PolarizationCounter++;
}
Thanks.
