Instruction Manual
UG_6612_036 78M6612 M-API Library User Guide
Rev. 1.00 3
Table of Contents
1 Introduction ......................................................................................................................................... 5
1.1 Terminology .................................................................................................................................. 5
1.2 Library Measurement Equations ................................................................................................... 6
1.3 Library Parameters ....................................................................................................................... 7
1.3.1 Global Symbols ................................................................................................................. 7
1.3.2 Formulae for Scaled Parameters ...................................................................................... 7
1.3.3 Example Calculation of Sensor Parameters ..................................................................... 8
1.4 Reference Documentation ............................................................................................................ 8
2 Firmware Partitions ............................................................................................................................ 9
3 Build Environment and Software/Firmware Configurations ........................................................ 10
3.1 Firmware Library and CE Memory Configurations ..................................................................... 10
3.2 Program and RAM Memory ........................................................................................................ 10
3.2.1 Program Memory ............................................................................................................. 10
3.2.2 RAM/Data Memory .......................................................................................................... 11
3.3 Build Configuration...................................................................................................................... 11
3.3.1 Flash/Code and RAM Size .............................................................................................. 11
3.3.2 Flash/Code Space Assignment ....................................................................................... 12
3.3.3 Library Assignment .......................................................................................................... 13
3.3.4 Module’s Selection within a Library ................................................................................. 14
4 MAPI Libraries ................................................................................................................................... 17
4.1 Library Initialization and Operation ............................................................................................. 17
4.1.1 MAPI_Init() ....................................................................................................................... 17
4.1.2 MAPI_MeterRun() ........................................................................................................... 17
4.1.3 MAPI_MinMaxSetGet() ................................................................................................... 17
4.2 Library Inputs and Outputs ......................................................................................................... 18
4.2.1 MAPI_GetSetRegister() ................................................................................................... 18
4.3 CE and MPU Control .................................................................................................................. 23
4.3.1 MAPI_CEOn().................................................................................................................. 23
4.3.2 MAPI_CEOff().................................................................................................................. 23
4.3.3 MAPI_GetCEName() ....................................................................................................... 23
4.3.4 MAPI_SoftReset() ........................................................................................................... 23
4.3.5 MAPI_HardReset() .......................................................................................................... 24
4.3.6 MAPI_UpdateMPU() ........................................................................................................ 24
4.3.7 MAPI_UpdateCE() ........................................................................................................... 24
4.4 Calibration and Power Measurement ......................................................................................... 25
4.4.1 MAPI_CalSetGet() ........................................................................................................... 25
4.4.2 MAPI_Calibrate() ............................................................................................................. 27
4.4.3 MAPI_MeterStatus() ........................................................................................................ 28
4.4.4 MAPI_TimeToAverage() .................................................................................................. 30
4.4.5 MAPI_GetEnergyUsed() .................................................................................................. 30
4.4.6 MAPI_GetVoltageCurrent() ............................................................................................. 31
4.5 Zero Crossing and Relay Control ............................................................................................... 32
4.5.1 MAPI_RelayConfig() ........................................................................................................ 32
4.5.2 MAPI_RelayControl () ..................................................................................................... 33
4.5.3 MAPI_CloseCircuit_0X() ................................................................................................. 33
4.5.4 MAPI_OpenCircuit_0X() .................................................................................................. 33
4.6 Soft-Timers ................................................................................................................................. 34
4.6.1 MAPIstm_init() ................................................................................................................. 34
4.6.2 MAPIstm_fn_start() ......................................................................................................... 34
4.6.3 MAPIstm_run() ................................................................................................................ 34
4.6.4 MAPIstm_wait() ............................................................................................................... 34