Maxim cannot assume responsibility for use of any circuitry other than circuitry entirely embodied in a Maxim product. No circuit
patent licenses are implied. Maxim reserves the right to change the circuitry and specifications without notice at any time.
Maxim Int egrated Products, 120 San Gabriel Drive, Sunnyvale, CA 9408 6 408-737-7600
2010 Maxim Integrated Products Maxim is a registered trademark of Maxim Integrated Products.
6 Contact Information .......................................................................................................................... 42
Revision History ........................................................................................................................................ 43
Figure
Figure 1: High Level Host/Firmware Interface Architecture
Tables
Table 1: CE Configuration ........................................................................................................................... 10
This document describes the Metrology Appl icat ion Pro gr am ming Interface (M-API) version 2.00 firmware
libraries available from Teridian for use with the 78M6612 IC. These libraries are specifically designed for
measurement and switch control of two (2) single-phase AC outlets (same phase).
The firmware delivery is a set of metrology libraries that configure and operate the measurement front
end (e.g. MUX, ADC, CE, etc.) and provides simplified access to measurement output data such as
Power, Voltage, Current, accumulated Energy and Line Frequency. All measurement calculations are
computed by the MAPI library every accumulation interval and mapped to a dedicated block of registers
reserved by the library.
Measurement data are made available to the user application via API calls. A demo application making
use of the M-API library set and serial UART interface is included as part of the 78M6612 OMU
Evaluation Kit.
Timer functions using the hardware RTC are also available and can be accessed directly by the
application. APIs specific to RTC are not available in the current library. Contact a Teridian
representative for more information on non-Volatile RTC operation (e.g. battery backup modes).
1.1 Terminology
The following terminology is used throughout this document:
• CREEP – Threshold value where meas urem ent outp ut s are sque lched t o zero.
• IMAX – External RMS current corresponding to 250 mVpk at the current input of the 78M6612. It should be set
IMAX= (Vpk/√2)/R
•VARs – Reactive Power (Q)
SENSE
.
• VAs – Apparent Power (S).
• Watts – Active Power (P).
• VMAX – External RMS voltage corresponding to 250 mVpk at the voltage input of the 78M6612 (VA, VB). It
must be set high enough to account for over-voltages.
• NB – Narrowband values.
• WB – Wideband values.
Rev. 1.00 5
78M6612 M-API Library User Guide UG_6612_036
1.2 Library Measurement Equations
The integrated Compute Engine (CE) accumulates the raw samples from the ADC and provides to the
80515 MPU the critical *atomic measurements needed to derive all other data. This consists of RMS
Voltage, Voltage Sag Status , and AC Line Freq uency data as well as RMS Current, Active Po wer, and
Reactive Power for each outlet. The MAPI library provides the application developer with two equation
options for processing the atomic values before updating the libraries output data registers. One equation
option is defined as “Narrowband” (NB) and the other is defined as “Wideband” (WB).
When using NB equations; RMS Voltage, Active Power, and Reactive Power data is provided by
the CE and used to derive RMS Current, Apparent Power, and Power Factor in the MPU for each
outlet. Harmonic content is not included in the reported current measurement.
*Voltage (V
Current (I
) = √∑v(t)2
RMS
) = S/V
RMS
RMS
*Active Power (P) = ∑ (i(t) * v(t))
*Reactive Power (Q) = ∑ (i(t) * v(t) shift 90º)
Apparent Power (S) = √(P
2
+ Q2)
Power Factor (PF) = P/S
When using WB equations (recommended); RMS Voltage, RMS Current, and Active Power data
provided by the CE is used to derive Reactive Power, Apparent Power, and Power Factor in the
MPU for each outlet.
*Voltage (V
*Current (I
) = √∑v(t)2
RMS
) = √∑i(t)2
RMS
*Active Power (P) = ∑ (i(t) * v(t))
RMS
2
– P2)
* I
RMS
Reactive Power (Q) = √(S
Apparent Power (S) = V
Power Factor (PF) = P/S
6 Rev. 1.00
UG_6612_036 78M6612 M-API Library User Guide
1.3 Library Parameters
This section describes critical constants and variable parameters of the MAPI library and their
recommended usage.
1.3.1 Global Symbols
The following symbols are fixed constants for the MAPI v2.00 firmware library:
The following variables are unique to the sensor configuration and represent the real world values
mapped to the upper range of the 78M6612 analog front end.
IMAX : 52 Amps for 4mOhm shunt
VMAX : 471.5 Volts
1.3.2 Formulae for Scaled Parameters
The measurement outputs (and respective alarm thresholds) for the M-API library are stored in a raw
format to preserve native resolution of the computed measurements. When using API calls to access or
fetch measurement data, the values are automatically scaled and converted according to the data types,
below.
I
rms
V
rms
Watts = float(Val)* POWERSCALE*IMAX*VMAX/1000
Frequency = integer(Val)/100
Val : library data
In some rare cases, when raw measurement data (Val) is directly accessed without going through the
library, which is not recommended, scaling to and from real world or usable values must be done using
the formulae above.
This example demonstrates the calculation of IMAX and VMAX for the default sensor configuration. For
more information on sensor selection and configuration, refer to the 78M6612 Hardware Design Guidelines.
The 78M6612 firmware provided by Teridian is partitioned into three main components:
•The Compute Engine (CE) firmware, although a separate set of source code, is a component of the
MAPI libraries responsible for precision Voltage, Current, Watts, and VARs measurements handled
by a dedicated processor. The source code for the CE is not described in this document or made
available for user modification.
•The 80515-based M-API firmware, in combination with the CE firmware, completes the M-API librar y
set and provides all the necessary IC configuration, calibration sub-routines, scaling, data conversion,
and timing control. This set of libraries is to be linked to the application firmware specific to the
desired host interface.
•The Application firmware exercises the M-API library and manages the communication to the host
controller/application. Teridian provides an example Serial Driver to be used as sample code as well
as the application firmware that uses this Serial Driver to exercise the MAPI library. Refer to the
applicable Firmware Description Document for more information on the application firmware.
Figure 1 shows a high level partitioning of the firmware architecture. The black boxes indicate object
and
code to be provided by Teridian. The white box indicates object
source code provided by Teridian.
Figure 1: High Level Host/Firmware Interface Architecture
Rev. 1.00 9
78M6612 M-API Library User Guide UG_6612_036
3 Build Environment and Software/Firmware Configurati ons
The Metrology Application Programming Interface (MAPI) is built using Keil Compiler version 8.02,
although any Keil version 7.00 or higher is also compatible.
The MAPI is built using specific default configuration as listed below.
3.1 Firmware Library and CE Memory Configurations
Processing of ADC inputs is done by the CE. The MAPI libraries are built to link to the specific CE code
according to the specific hardware conf ig urati on. The table below shows the different libraries as built
with specific CE code to support different configurations:
Table 1: CE Configuration
Library Name Default Accumulation Interval = 500ms
6612S22_WB_MAPI.lib Built for Wide-Band.
6612S22_NB_MAPI.lib Built for Narrow-Band.
3.2 Program and RAM Memory
The embedded 80515 MPU within the 78M6612 has separate program memory (32K bytes) and data
memory (2K bytes).
3.2.1 Pr ogr am Memory
The Flash program memory is non-volatile and is segmented into 512-byte pages. The last 2.5K (five
512-byte pages) of Flash space is reserved for CE data, CE code and default values used for Energy
Calibration and Measurement. The code for the Compute Engine program resides in the MPU program
memory (flash) and must begin on 1K-byte boundary.
Table 1 below shows the partitions of Flash memory.
Table 2: Flash Memory Map
Address (hex) Type Typical Usage
0000-75FF
7600-773E
777F-7FFF Non-volatile
Non-volatile
Non-volatile
Program and any non-volatile
data. Shared by the MAPI and
application layer.
Reserved for MAPI energy
measurement constants
(defaults).
Reserved for CE code and CE
data.
Wait States
(at 5 MHz)
0
0
0
Size (bytes)
29.5KB
< ~350B
2KB
10 Rev. 1.00
UG_6612_036 78M6612 M-API Library User Guide
3.2.2 RAM/Data Memory
The 78M6612 has 2K bytes of Data Memory for exclusive use by the embedded 80515 MPU library and
application layers. In addition, there are 512 bytes reserved for the Compute Engine.
Table 3: Data RAM Shared by CE and MPU
Address (hex) Type Typical Usage Size (bytes)
0000-07FF Volatile MPU data XRAM, 2KB
1000-11FF Volatile CE data 512
2000-20FF Volatile
Miscellaneous I/O RAM
(configuration RAM)
256
3.3 Build Configuration
The accompanying example application source code has been set up to link to each library under specific
hardware configuration. Each configuration is defined under a different ‘Target’. However, for all ‘Targets’,
specific area of Flash is reserved for specific function as described below.
3.3.1 Flash/Code and RAM Size
The attached zipped file (78M6612MAPIv200.zip) contains a sample Application code, of which source
code is also included. The functions of this application are detailed in Section 6.
This sample applic at ion is taking up Flash/RAM usage according to the table below. It was written to
demonstrate the use of the MAPI libraries via two types of commands: the ‘M’ commands (as shown in
Section 6) to specifically address the MAPI calls; and the ‘CLI’, aka Command Line Interface, commands
for backward compatibility to support those who have evaluated, or are familiar with, Teridian OMU
products in the past.
The following tables show RAM and Flash consumptions by this sample application. They also show a
breakdown of Flash consumption by different features as implemented in the MAPI libraries.
Table 4: Flash and RAM Consumption by MAPI and Sample Application
Firmware Module
6612S22_WB_MAPI.lib
6612S22_NB_MAPI.lib
6612IVIV_50F0_v200WB.hex
6612IVIV_50F0_v200NB.hex
Table 5: Breakdown of M-API’s Flash Consumption
Library:
6612S22_WB_MAPI.lib
6612S22_NB_MAPI.lib
Calibration 5.7K Includes calibration for: Temperature, Current, Voltage,
MAPI Interface (to App) 1.5K Direct interface to the library from application.
Flash Manager 2K Flash Read/Write management.
Rev. 1.00 11
RAM
Used
~ 26K The RAM usage is overlay-able. See the
1.7K 6K + 26K(lib) The app from this build uses every single API
Flash Used Features
Flash Used Note
breakdown of Flash usage in Table 5.
library call.
Watt and Phase.
Registers, etc.
78M6612 M-API Library User Guide UG_6612_036
Metering 6K Metrology functions (alarms, power factor, RMS, etc.)
Measurement 2K Metrology computations
Serial Driver 1K Serial 0/RS232 I/O
Timer < 0.5K Timer 0 driver.
Relay Management/Misc . 2K Relay Control/On/Off, some math logic, IRQ.
3.3.2 Flash/Code Space Assignment
As shown in Table 1, in order to reserve specific regions of Flash for specific MAPI default data, CE code
and CE data, the build file of the firmware application must be setup to specify where the modules will
reside. It is necessary to keep images of CE code/data and default data isolated at the application’s build
file. The accompanying application code has setup these assignments as follows: Default data is at
starting address 0x7600. CE Data is at starting address 0x777E. CE Code is at starting address
0x77FE.
This information is represented in the mapped file (.M51) as follows:
SEGMENTS (?CO?DEFAULTS(C:0X7600),
The firmware application source code, as shipped with this document, is setup such that its project file
contains all the supported libraries as built for the specific CE code and data to support different
configuration options. As sho wn in the projec t, the libr ar ies built for Narrow-Band and Wide-Band are
included in the project but only one library shall be selected to be built with a specific ‘Target’ at a time.
The ‘Target’s as defin ed in the Keil proj ec t file for the sample application are shown below. When modify
this project’s targets, it is important that the correct library is selected:
Rev. 1.00 13
Loading...
+ 29 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.