亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? meter.h

?? TDK 6521 SOC 芯片 DEMO程序
?? H
?? 第 1 頁 / 共 2 頁
字號:
/***************************************************************************
 * This code and information is provided "as is" without warranty of any   *
 * kind, either expressed or implied, including but not limited to the     *
 * implied warranties of merchantability and/or fitness for a particular   *
 * purpose.                                                                *
 *                                                                         *
 * Copyright (C) 2005 Teridian Semiconductor Corp. All Rights Reserved.    *
 ***************************************************************************/
//**************************************************************************
//  DESCRIPTION: 71M65xx POWER METER -
//               Meter structures, enumerates, and defines.
//
//  AUTHOR:  MTF
//
//  HISTORY: See end of file.
//**************************************************************************
// File: METER.H
//
#ifndef METER_H
#define METER_H
#include "rtc.h"
/////////////////////////////////////////////////////////////////////////////
//***************************************************************************
//* METER DEFINITIONS AND DECLARATIONS
//***************************************************************************
/////////////////////////////////////////////////////////////////////////////
#define FS     (32768. / 13.)    // Frame sample rate (about 2520.6 s/s).

struct Parameters_t
{                               // MPU address.
    uint32_t T_IThrshld;        // Starting current. (Current threshold)
    uint8_t  T_Config;          // Configuration Control.
    uint32_t T_VPThrshld;       // Peak voltage threshold. LSB as v0sqsum
    uint32_t T_IPThrshld;       // Peak current threshold. LSB as i0sqsum
    int16_t  T_Y_Cal_Deg0;      // Crystal calibration constants, RTC only.
    int16_t  T_Y_Cal_Deg1;      //
    int16_t  T_Y_Cal_Deg2;      //
    uint8_t  T_PulseWSource;    // Select one of 21 sources for APULSEW.
    uint8_t  T_PulseRSource;    // Select one of 21 sources for APULSER.
    uint16_t T_Vmax;            // VMax in 100 mVolts.
    uint16_t T_Imax;            // IMax in 100 mAmps.
    int16_t  T_ppmc1;           //-6680    -6.680 * (ppm/c)   * 1000; PPM/C   * 26.84.
    int16_t  T_ppmc2;           //-341    -0.341 * (ppm/c^2) * 1000; PPM/C^2 * 1374.
    uint8_t  T_Pulse3Source;    // software pulse sources
    uint8_t  T_Pulse4Source;    //
    uint16_t T_Scal;            // seconds of calibration.
    uint16_t T_Vcal;            // calibration voltage, LSB = 0.1V (like VMAX).
    uint16_t T_Ical;            // calibration current, LSB = 0.1A (like IMAX).
    uint32_t T_VThrshld;        // Minimum voltage threshold.
    int16_t  T_PulseWidth;      // 50       The maximum wpulse and vpulse width is 2*PULSEWIDTH+1 samples.
    int32_t  T_temp_nom;        // Temperature reading at calibration;
    uint16_t T_Imax2;           // IMaxw in 100 mAmps.
    uint32_t T_IThrshld2;       // Starting current, sensor 2.
    int32_t  T_VBatMin;         // Battery minimum, ADC units
    uint8_t T_Reserved;         // unused space
    uint8_t T_lrc;              // checksum
};

#define SUM_SIZE 8
typedef struct { uint8_t a[ SUM_SIZE ]; } SUM_t;

// The offsets into this structure are documented, so they shouldn't change.
// This structure is cleared on reset, and recalculated on each accumulation
// interval.  The values need not be saved on sag.
// To make some of this data into a nonvolatile revenue register, just
// move the register group into Acc_T, below, and change the equates, also below.
struct Sums_t          // LSB = 9.4045E-13 Watt/VAR/VA hours.
{
    int8_16_32_t T_Status;     // Status.  [Maintained by MPU].

    int32_t T_cai;             // count of accumulation intervals

    SUM_t T_Whi;               // Total Watt hours imported (All Phases).
    SUM_t T_Whi_A;             // Total Watt hours imported (Phase A).
    SUM_t T_Whi_B;             // Total Watt hours imported (Phase B).
    SUM_t T_Whi_C;             // Total Watt hours imported (Phase C).

    SUM_t T_VARhi;             // Total VAR  hours imported (All Phases).
    SUM_t T_VARhi_A;           // Total VAR  hours imported (Phase A).
    SUM_t T_VARhi_B;           // Total VAR  hours imported (Phase B).
    SUM_t T_VARhi_C;           // Total VAR  hours imported (Phase C).

    SUM_t T_VAh;               // Total VA  hours combined (All Phases).
    SUM_t T_VAh_A;             // Total VA  hours          (Phase A).
    SUM_t T_VAh_B;             // Total VA  hours          (Phase B).
    SUM_t T_VAh_C;             // Total VA  hours          (Phase C).

    SUM_t T_Whe;               // Total Watt hours exported (All Phases).
    SUM_t T_Whe_A;             // Total Watt hours exported (Phase A).
    SUM_t T_Whe_B;             // Total Watt hours exported (Phase B).
    SUM_t T_Whe_C;             // Total Watt hours exported (Phase C).

    SUM_t T_VARhe;             // Total VAR  hours exported (All Phases).
    SUM_t T_VARhe_A;           // Total VAR  hours exported (Phase A).
    SUM_t T_VARhe_B;           // Total VAR  hours exported (Phase B).
    SUM_t T_VARhe_C;           // Total VAR  hours exported (Phase C).

//----------------------------------------------------------------------//
    // These are used for phased calibration and net metering
    SUM_t T_Whn;               // net-metered Whs for element A
    SUM_t T_Whn_A;             // net-metered Whs for element A
    SUM_t T_Whn_B;             // net-metered Whs for element B
    SUM_t T_Whn_C;             // net-metered Whs for element C

    // These are used for phased calibration and net metering
    SUM_t T_VARh;             // net-metered VARs for element A
    SUM_t T_VARh_A;             // net-metered VARs for element A
    SUM_t T_VARh_B;             // net-metered VARs for element B
    SUM_t T_VARh_C;             // net-metered VARs for element C

    // This ought to be cleared when )1=2
    // This is also used when the RTC is locked to the line frequency
    int32_t T_MainEdgeCount;  // count of zero crossings.
};

// This structure is saved on sag.  It should be as small as possible.
// It must contain all revenue registers.
struct Accumulators_t
{
    // Demonstration revenue registers
    // 1 phase meter preserves sum data
    SUM_t T_Whr;               // Total Watt hours (All Phases).
    // 3-phase meter preserves phase data, calculates sum data
    SUM_t T_Whr_A;             // Total Watt hours (Phase A).
    SUM_t T_Whr_B;             // Total Watt hours (Phase B).
    SUM_t T_Whr_C;             // Total Watt hours (Phase C).

    // nonvolatile error status
    int32_t T_Status;          // Bit-per-error

    // brownout data
    uint32_t T_brownout_cache;
    uint8_t T_brownout_cache_mode;
    uint8_t T_brownout_cache_valid;

    // Nonvolatile timekeeping data
    #if REAL_TIME_DATE
    struct RTC_t T_Rtc_Time_Date; // most recent RTC Time and Date.
    #endif
    #if REAL_TIME_DATE && !RTC_LINE_LOCKED
    // manage the real time clock so that it can be
    // compensated for the time the device is off.
    volatile int32_t T_trim_count; // signed values can cancel as
    volatile int32_t T_trim_value; // the temperature varies.
    // the second count has to be able to hold +/-900 1 second
    // adjustments in case the meter is on the shelf for five years,
    // crystal running at +/-6ppm, each year is ~30 million seconds.
    volatile int16_t T_second_count; // queues multiple adjustments
    #endif

    #if OPERATING_TIME
    uint32_t T_OperatingSeconds; // Total Seconds of Operation.
    #endif

    uint8_t T_CalibrationCount; // count of calibrations

    uint8_t lrc;               // space for the longitudinal error check
};


#if ERROR_RECORDING
// private data structures
struct Er
{
    uint8_t errno;   // error number, same as the bit number of Status
    uint8_t cnt;     // error count
    uint8_t month;
    uint8_t date;
    uint8_t hour;
};

#define cer 5
#define ierMax (cer - 1) // maximum error index
struct Errors_t
{
    struct Er aer[cer];  // array of error records
    int32_t status;     // private copy of status
    uint8_t lrc;    // space for the longitudinal error check
};

#define Aer Totals.Err.aer
#define OldStatus Totals.Err.status
#endif

// These can be updated as often as once every 200 ms.
//
struct Totals_t
{
    // everything up to and including "Sums" tries to be unconditional, to preserve
    // the memory structure for use by the CLI, and memory-reading serial protocols.
    struct Parameters_t Parms; // Parameters

    uint8_t T_main_edge_cnt_nom; // nominal edges per second of mains

    // after this, it's all 4 and 8 byte values, so the CLI can index them
    // Deviation from 22C, TEMP_NOM - TEMP; LSB 0.1 degrees C.
    int32_t T_deltaT;         // Delta temperature from cal. temp.[Computed by MPU].
    uint32_t T_Frequency;     // Frequency.                       [Computed by MPU].
    int32_t T_VBat;           // Last measured voltage of battery [Computed by MPU].
    int32_t T_Irms_N;         // Irms neutral.                    [Computed by MPU].
    int32_t T_Vrms_A;         // Vrms from element 0 (A).         [Computed by MPU].
    int32_t T_Irms_A;         // Irms from element 0 (A).         [Computed by MPU].
    int32_t T_Vrms_B;         // Vrms from element 1 (B).         [Computed by MPU].
    int32_t T_Irms_B;         // Irms from element 1 (B).         [Computed by MPU].
    int32_t T_Vrms_C;         // Vrms from element 2 (C).         [Computed by MPU].
    int32_t T_Irms_C;         // Irms from element 2 (C).         [Computed by MPU].
    struct Sums_t Sums;       // Accumulated Energies.            [Computed by MPU].

    // If the power fails during the calculation of the nonvolatile
    // registers, the second copy will still be valid when both copies are saved and restored.
    struct Accumulators_t Acc; // Nonvolatile registers.           [Computed by MPU].
    struct Accumulators_t AccB; // Nonvolatile registers.          [Computed by MPU].

    // error recording
    #if ERROR_RECORDING
    struct Errors_t Err;
    #endif

    #if POWER_FACTOR
    // Power factors, LSB = 1/100000, so it displays in a percent, with three decimals
    int16_t T_Pf_A;        // from element 0 (A).  [Computed by MPU].
    int16_t T_Pf_B;        // from element 1 (B).  [Computed by MPU].
    int16_t T_Pf_C;        // from element 2 (C).  [Computed by MPU].
    #endif

    #if PHASE_ANGLES
    // V/I phase angle, LSB = 1/10 degree, so it displays with 1 decimal
    int32_t T_IPhase_A;    // I0:V0 phase from element 0 (A).  [Computed by MPU].
    int32_t T_IPhase_B;    // I1:V1 phase from element 1 (B).  [Computed by MPU].
    int32_t T_IPhase_C;    // I2:V2 phase from element 2 (C).  [Computed by MPU].
    #endif

    #if VOLTAGE_PHASES
    // V/V phase angle, LSB = 1/10 degree, so it displays with 1 decimal
    int32_t  T_VPhase_AB;  // Voltage AB Phase angle.          [Computed by MPU].
    int32_t  T_VPhase_AC;  // Voltage AC Phase angle.          [Computed by MPU].
    #endif
};

// Definitions for 'Config'.
#define CFG_VAH_SELECT  0x01            // Select VAh equation; 1 => V*I, 0 => sqrt(W^2 + VAR^2).
#define CFG_CLEAR_ACC   0x02            // Initialize accumulators (auto clear)
#define CFG_CAL         0x04            // Run calibration
#define CFG_TAMPER      0x08            // Enable tamper detection.
#define CFG_OPTICAL     0x10            // Enable/disable optical port test.

// Definitions for 'Status'.  Feel free to add to them.
#define CREEP       BIT0                // Creep Alert.
#define MINVC       BIT1                // Under Min VA.
#define PB_PRESS    BIT2                // push button detected
#define WAKE_ALARM  BIT3                // wake timer detected
#define MINVB       BIT4                // Under min VB. 
#define MAXVA       BIT5                // Over max. voltage
#define MAXVB       BIT6                // Over max. voltage
#define MAXVC       BIT7                // Over max. voltage
#define MINVA       BIT8                // Under min VC.
#define WD_DETECTED BIT9                // Unexpected reset.
#define RESERVED_10 BIT10               // Use as needed.
#define MAXIA       BIT11               // Over max. current on A
#define MAXIB       BIT12               // Over max. current on B
#define MAXIC       BIT13               // Over max. current on C
#define MINT        BIT14               // Min. temperature exceeded
#define MAXT        BIT15               // Max. temperature exceeded
#define BATTERY_BAD BIT16               // Battery test failed
#define RESERVED_17 BIT17               // Use as needed.
#define CAL_BAD     BIT18               // Calibration is invalid
#define CLOCK_UNSET BIT19               // Clock is not set
#define POWER_BAD   BIT20               // Power register data was lost
#define GNDNEUTRAL  BIT21               // Grounded neutral detected
#define TAMPER      BIT22               // Tamper detected
#define VXEDGE      BIT23
#define RESERVED_24 BIT24
#define SAGA        BIT25               // Sag detected; conductor A
#define SAGB        BIT26               // Sag detected; conductor B
#define SAGC        BIT27               // Sag detected; conductor C
#define F0_CE       BIT28
#define RESERVED_29 BIT29               // Use as needed.
#define RESERVED_30 BIT30               // Use as needed.
#define ONE_SEC     BIT31

// The events that are worth recording
#define WORTH_RECORDING ( \
        TAMPER \
        | GNDNEUTRAL \
        | CLOCK_UNSET \
        | POWER_BAD \
        | CAL_BAD \
        | BATTERY_BAD \
        | MAXT \
        | MINT \
        | MAXIA \
        | MAXIB \
        | MAXIC \
        | SAGA \
        | SAGB \
        | SAGC \
        )
#define MAX_ERR_CNT 14

//================================================================================================//
#define IThrshld      Totals.Parms.T_IThrshld
#define Config        Totals.Parms.T_Config
#define VPThrshld     Totals.Parms.T_VPThrshld
#define IPThrshld     Totals.Parms.T_IPThrshld
#define Y_Cal_Deg0    Totals.Parms.T_Y_Cal_Deg0
#define Y_Cal_Deg1    Totals.Parms.T_Y_Cal_Deg1
#define Y_Cal_Deg2    Totals.Parms.T_Y_Cal_Deg2
#define PulseWSource  Totals.Parms.T_PulseWSource
#define PulseRSource  Totals.Parms.T_PulseRSource
#define Vmax          Totals.Parms.T_Vmax
#define Imax          Totals.Parms.T_Imax
#define ppmc1         Totals.Parms.T_ppmc1      
#define ppmc2         Totals.Parms.T_ppmc2      
#define Pulse3Source  Totals.Parms.T_Pulse3Source
#define Pulse4Source  Totals.Parms.T_Pulse4Source
#define Scal          Totals.Parms.T_Scal
#define Vcal          Totals.Parms.T_Vcal
#define Ical          Totals.Parms.T_Ical
#define VThrshld      Totals.Parms.T_VThrshld
#define PulseWidth    Totals.Parms.T_PulseWidth 
#define temp_nom      Totals.Parms.T_temp_nom
#define Imax2         Totals.Parms.T_Imax2
#define IThrshld2     Totals.Parms.T_IThrshld2
#define VBatMin       Totals.Parms.T_VBatMin
//---------------------------------------------------------------------------//
// Deviation from 22C, TEMP_NOM - TEMP; LSB 0.1 degrees C.
#define deltaT        Totals.T_deltaT
#define Frequency     Totals.T_Frequency
#define VBat          Totals.T_VBat
#define Irms_N        Totals.T_Irms_N
#define Vrms_A        Totals.T_Vrms_A
#define Irms_A        Totals.T_Irms_A
#define Vrms_B        Totals.T_Vrms_B
#define Irms_B        Totals.T_Irms_B
#define Vrms_C        Totals.T_Vrms_C
#define Irms_C        Totals.T_Irms_C
#define Pf_A          Totals.T_Pf_A
#define Pf_B          Totals.T_Pf_B
#define Pf_C          Totals.T_Pf_C
#define IPhase_B      Totals.T_IPhase_B
#define IPhase_C      Totals.T_IPhase_C
#define IPhase_A      Totals.T_IPhase_A
#define IPhase_B      Totals.T_IPhase_B
#define IPhase_C      Totals.T_IPhase_C
#define VPhase_AB     Totals.T_VPhase_AB
#define VPhase_AC     Totals.T_VPhase_AC
//----------------------------------------------------------------------------//
// The watt hour registers are used in a table in meter.c.
// It has to be populated or the display fails.  Therefore,
// these are all defined.
// Nonvolatile "revenue registers" are in "Acc" rather than "Sums"
// The table is also accessed by ) in the command line interface,
#define Status        Totals.Sums.T_Status.l

#define cai           Totals.Sums.T_cai

// Other stuff; optional
#define Whi           Totals.Sums.T_Whi.a
#define Whi_A         Totals.Sums.T_Whi_A.a
#define Whi_B         Totals.Sums.T_Whi_B.a
#define Whi_C         Totals.Sums.T_Whi_C.a

#define VARhi         Totals.Sums.T_VARhi.a
#define VARhi_A       Totals.Sums.T_VARhi_A.a
#define VARhi_B       Totals.Sums.T_VARhi_B.a

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲免费观看高清完整版在线观看| 成人激情图片网| 久久综合国产精品| 国产精品自拍三区| 久久精品网站免费观看| 国产在线不卡一卡二卡三卡四卡| 亚洲国产欧美在线人成| 亚洲一区二区三区中文字幕| 国产成人自拍在线| 在线一区二区三区| 欧美一激情一区二区三区| 欧美一区二区免费视频| 午夜欧美在线一二页| va亚洲va日韩不卡在线观看| 在线一区二区视频| 亚洲六月丁香色婷婷综合久久 | 成人精品gif动图一区| 这里只有精品免费| 99久久精品免费看国产| 欧美高清在线一区| 亚洲国产视频一区| 91麻豆精品国产91| 粉嫩在线一区二区三区视频| 天天影视涩香欲综合网| 99久久精品情趣| 中文字幕日本乱码精品影院| 亚洲色图20p| 亚洲国产成人tv| 欧美综合亚洲图片综合区| 日本美女视频一区二区| 一区二区三区波多野结衣在线观看| 国产精品高潮久久久久无| 韩国欧美国产一区| 日韩精品一区二区三区在线 | 亚洲国产美女搞黄色| 99精品一区二区| 国产精品久久久99| 成人一级视频在线观看| 国产精品女同一区二区三区| 高清成人免费视频| 国产午夜亚洲精品不卡| 国产1区2区3区精品美女| 中文字幕av不卡| 丁香婷婷综合五月| 亚洲欧洲一区二区在线播放| 99精品久久久久久| 一区二区三区资源| 欧美日韩国产精品成人| 爽好久久久欧美精品| 欧美一级理论片| 国内精品伊人久久久久影院对白| 欧美成人精品高清在线播放| 国内成人免费视频| 国产欧美久久久精品影院| 大陆成人av片| 一区二区三区四区在线免费观看| 欧美久久一二区| 国产自产2019最新不卡| 中文字幕乱码久久午夜不卡 | 久久久美女艺术照精彩视频福利播放| 国内精品第一页| 中文字幕在线观看一区| 色综合久久中文综合久久97| 视频一区在线视频| 久久久一区二区三区| 91视频观看免费| 免费成人你懂的| 国产精品天美传媒| 欧美色视频在线| 韩国视频一区二区| 亚洲精品自拍动漫在线| 日韩一级在线观看| 国产不卡免费视频| 亚洲成人av免费| 国产日韩成人精品| 精品1区2区3区| 国产成人在线网站| 五月婷婷久久丁香| 日本一区二区三区dvd视频在线 | 国产在线一区二区| 伊人婷婷欧美激情| 精品国产乱码久久久久久牛牛| 成人综合日日夜夜| 日本不卡一区二区三区| 中文字幕在线观看一区| 精品蜜桃在线看| 欧美影院一区二区| 国产成人免费av在线| 日韩av不卡在线观看| 中文字幕一区二区三区精华液| 日韩一区二区精品在线观看| 色婷婷激情久久| 国产一区三区三区| 青青草成人在线观看| 日韩毛片一二三区| 国产亚洲视频系列| 91精品国产高清一区二区三区| k8久久久一区二区三区 | 91精品久久久久久蜜臀| 色综合久久天天| 国产成人av在线影院| 久久精品国产999大香线蕉| 亚洲大片一区二区三区| 亚洲天堂成人网| 欧美国产国产综合| 久久九九影视网| 精品国产免费久久| 欧美成人官网二区| 欧美大度的电影原声| 91精品国产欧美一区二区| 欧美色网一区二区| 欧美无人高清视频在线观看| 色婷婷av一区| 在线精品视频免费观看| 色婷婷国产精品| 日本高清无吗v一区| 99久久精品久久久久久清纯| 岛国av在线一区| 91在线视频在线| 91色视频在线| 欧美日韩中文一区| 欧美日韩一区二区三区不卡 | jizz一区二区| 91在线免费看| 91免费看`日韩一区二区| 99久久国产综合精品麻豆| 99综合影院在线| 一本到三区不卡视频| 在线观看亚洲一区| 欧美日韩一区二区电影| 欧美日韩性生活| 日韩欧美一区在线观看| 精品国精品自拍自在线| 久久久久久久网| 国产精品视频一二| 尤物av一区二区| 日韩不卡一区二区| 国产一区二区三区免费| 国产999精品久久久久久绿帽| 99久久婷婷国产综合精品 | 亚洲精品一二三| 亚洲高清视频在线| 麻豆国产欧美日韩综合精品二区 | 一区二区激情小说| 三级久久三级久久| 国产一区二区毛片| av男人天堂一区| 欧美日韩国产高清一区| 日韩欧美的一区二区| 国产精品国产自产拍高清av | 在线观看亚洲一区| 欧美欧美欧美欧美首页| 精品国产乱子伦一区| 中文字幕一区二区在线播放 | 免费成人在线网站| www.日韩av| 欧美日韩国产电影| 欧美国产日韩在线观看| 亚洲午夜国产一区99re久久| 国产一二精品视频| 欧美日韩精品二区第二页| 久久久久99精品国产片| 亚洲国产一区视频| 国产99精品视频| 91精品福利在线一区二区三区| 国产精品免费aⅴ片在线观看| 亚洲国产综合视频在线观看| 国产成人精品三级麻豆| 欧美高清dvd| 亚洲人成网站影音先锋播放| 麻豆成人av在线| 色婷婷一区二区| 国产女主播视频一区二区| 亚洲成人福利片| 91美女片黄在线观看91美女| 精品国偷自产国产一区| 午夜精品福利久久久| 99麻豆久久久国产精品免费优播| 日韩一区二区不卡| 午夜精品久久一牛影视| 色婷婷久久综合| 亚洲国产经典视频| 激情综合色综合久久| 欧美美女直播网站| 一区二区在线观看av| 国产成人精品免费视频网站| 日韩一区二区高清| 午夜亚洲国产au精品一区二区| 99精品偷自拍| 国产精品超碰97尤物18| 国产成人啪午夜精品网站男同| 337p亚洲精品色噜噜| 丝袜美腿亚洲一区二区图片| 欧美视频一区二区三区| 亚洲激情在线激情| 91热门视频在线观看| 中文字幕亚洲区| 99久久99久久久精品齐齐| 久久精品日产第一区二区三区高清版 | 亚洲美女在线一区|