2 mapi_calibrate(), Mapi_calibrate() – Maxim Integrated 78M6612 M-API Library User Manual
Page 27

UG_6612_036
78M6612 M-API Library User Guide
Rev. 1.00
27
4.4.2 MAPI_Calibrate()
Purpose
Calibrate the part using referenced meter values and tolerance values as
specified in the MPU_CParms_t data structure (see the
MAPI_CalSetGet
API
for more information).
A typical application shall use this API as follows:
1. Call MAPI_CalSetGet (FALSE, ….) to get current calibration data.
2. If necessary, call MAPI_CalGetSet (TRUE,…) to set new calibration data
(tolerance values, referenced values, average count, maximum count, etc.).
3. Call MAPI_Calibrate() to start the calibration.
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.
It is up to the application level to select the CAL_TYPE appropriately. It is
recommended that temperature calibration (CTYPE = C_TEMP) shall always be
part of CAL_TYPE; thus, C_TEMP shall always be OR’ing with c_type. When
this API is called with multiple CAL_TYPEs, calibration will be done in the
following order:
Temperature,
Phase,
Voltage,
Current,
Wattage.
Make sure the referenced values are setup correctly, using MAP_CalSetGet();
otherwise, calibration will not pass. See
When the return code is not MAPI_OK, call
MAPI_CalStatus()
to get detailed
descriptions of the calibration error(s). If an error occurs during this call, the part
is NOT calibrated. It is the task of the application to call this API again if
recalibration of the part is necessary.
Synopsis
MAPI_RC MAPI_Calibrate(IN enum CAL_TYPE c_type,
IN Unsigned Char Outlets);
Parameters
c_type
Input parameter.
The following types are acceptable:
Enum CAL_TYPE {
C_WATT
= 0x01 – Calibrate Wattage.
C_VOLT
= 0x02 – Calibrate Voltage.
C_CURRENT
= 0x04 – Calibrate Current.
C_PHASE
= 0x08 – Calibrate Phase Adjust.
C_TEMP
= 0x10 – Calibrate Temperature.
}
Calibration source. The values can be OR’ing. For example: C_WATT | C_VOLT
indicate calibration to be done on Voltage first, then Wattage; C_TEMP | C_VOLT
indicate calibration to be done on Temperature then Voltage.