Instruction Manual
UG_6612_036 78M6612 M-API Library User Guide
Rev. 1.00 25
4.4 Calibration and Power Measurement
4.4.1 MAPI_CalSetGet()
Purpose Set or Get Calibration referenced and tolerance parameters as specified in the
MPU_CParms_t structure. New values are kept in RAM only. When all
calibration data is setup and calibrated correctly, it shall be kept and recorded,
permanently in Flash by calling MAPI_UpdateCE() and MAPI_UpdateMPU().
A typical calibration of the part proceeds as follows:
1. Call MAPI_CalSetGet (FALSE, ….) to get current calibration data.
2. If necessary, call MAPI_SetGetCal (TRUE,…) to set new calibration data
(tolerance values, referenced values, etc.).
3. Call MAPI_Calibrate() to start the calibration. If calibration passes,
continue to step 4. If calibration fails, repeat step 1.
4. Call MAPI_UpdateCE() and MAPI_UpdateMPU() to permanently update
the new values in Flash.
5. Call MAPI_CalSetGet (FALSE,…) to make sure the new data is written,
preserved and correct.
Synopsis Bool MAPI_CalSetGet(IN unsigned char SetData,
Struct MPU_CParms_t *MAPI_CParams);
Struct MPU_CParms_t
{
uint8_t C_Tcal; // Type calibration. Read-Only.
float C_Wcal; // Wattage calibration value (Watts).
float C_Vcal; // Voltage calibration value (Vrms).
float C_Ical // Current calibration value (Arms).
int16_t C_Pcal; // Phase calibration value (Degrees).
float C_Wtolerance; // Watts Tolerance (Watts).
float C_Vtolerance; // Voltage Tolerance (Vrms).
float C_Itolerance; // Current Tolerance (Arms).
float C_Ptolerance; // Phase Tolerance (degrees).
uint8_t C_Vavg_cnt; // Voltage Average count.
uint8_t C_Iavg_cnt; // Current Average count.
uint8_t C_Wavg_cnt; // Watts Average count.
uint16_t C_Vmax_cnt; // Voltage Max count.
uint16_t C_Imax_cnt; // Current Max count.
uint16_t C_Wmax_cnt; // Watts Max count.
uint16_t C_Wrate_cal; // Wrate during calibration
(~.32Kh). Read-Only
uint16_t C_Tempcal; // Calibration temperature (0.1
degree).
};