
Embedded Metering Library API
5.5.1.2.13 thd_t current_thd (int ph)
Returns the latest THD on current of phase ph
Parameter: ph = 1
Return: latest THD on current of phase
5.5.1.2.14 int16_t mains_frequency (int ph)
Returns the measured ac frequency of phase ph. The returned value of this function is invalid when the
EVM is operating in dc measurement mode.
Parameter: ph = 1
Return: latest ac frequency measured on phase ph
5.5.1.2.15 uint16_t phase_status (int ph)
Returns the status word of phase ph.
Parameter: ph = 1
Return: status word of phase ph
5.5.2 Embedded Metering Library Callbacks
The embedded metering library uses callbacks to call to functions defined in the application program as an
indication of events. The callbacks are declared in emeter-metrology.h and the function implementation
must be provided in the application code (even an empty function is acceptable, in case there is no need
to process the event). In the provided application example, the callback functions are implemented in
emeter-main.c.
5.5.2.1
void BACKGROUND_PROCESS_ON (void)
Called when background process starts.
5.5.2.2
void BACKGROUND_PROCESS_OFF (void)
Called when background process finished.
5.5.2.3
void FOREGROUND_PROCESS_ON (void)
Called when foreground process starts.
5.5.2.4
void FOREGROUND_PROCESS_OFF (void)
Called when foreground process finished.
5.5.2.5
void ZERO_CROSS_ON (void)
Called when the background process detects that the voltage signal is zero crossing from positive to
negative.
5.5.2.6
void ZERO_CROSS_ON (void)
Called when the background process detects that the voltage signal is zero crossing from negative to
positive.
5.5.2.7
void AC_MODE_ON (void)
Called when the background process enters ac measurement mode.
40
Firmware and Embedded Metering Library API
SLAU587 – August 2014
Copyright © 2014, Texas Instruments Incorporated