亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
日韩一区二区视频在线观看| 日韩三级视频在线看| 青娱乐精品视频| 国产精品对白交换视频| 日韩欧美一区电影| 91免费在线看| 国产成人a级片| 久久国产福利国产秒拍| 亚洲成人激情自拍| 亚洲欧美另类图片小说| 337p日本欧洲亚洲大胆精品| 欧美精品自拍偷拍动漫精品| 不卡的av电影| 成人听书哪个软件好| 久久se这里有精品| 日本亚洲视频在线| 亚洲成人免费在线| 亚洲精品成人悠悠色影视| 国产精品丝袜在线| 久久精品视频免费观看| 日韩精品一区二| 欧美一区三区二区| 欧美午夜影院一区| 在线免费av一区| 色综合一区二区三区| 国产成人小视频| 国内外成人在线视频| 青青国产91久久久久久| 天天影视网天天综合色在线播放| 亚洲精品自拍动漫在线| 亚洲日本护士毛茸茸| 国产精品久久久久国产精品日日 | 欧美电影影音先锋| 欧美色老头old∨ideo| 色婷婷av一区二区三区大白胸 | 国产成人在线免费观看| 国产一区二区调教| 国产在线视频一区二区| 黄色小说综合网站| 国产超碰在线一区| 成人精品免费视频| 91在线观看下载| 91视频.com| 欧美丝袜丝交足nylons图片| 欧美性色综合网| 欧美日韩激情一区二区三区| 欧美美女黄视频| 欧美一区二区成人6969| 91精品国产综合久久香蕉麻豆 | 色爱区综合激月婷婷| 色综合色狠狠天天综合色| 91美女在线视频| 欧美日韩一级二级| 91精品国产丝袜白色高跟鞋| 欧美成人a∨高清免费观看| 久久免费看少妇高潮| 亚洲国产精品成人综合| 亚洲欧美日韩电影| 日韩成人免费在线| 狠狠色狠狠色综合| 国产成人超碰人人澡人人澡| 一本久道中文字幕精品亚洲嫩| 欧美午夜不卡视频| 日韩欧美国产一区二区三区 | 91首页免费视频| 91极品视觉盛宴| 欧美一级理论片| 国产亚洲精品7777| 一区二区三区日韩在线观看| 麻豆中文一区二区| 成人国产一区二区三区精品| 精品视频全国免费看| 中文字幕中文字幕一区| 一区二区三区四区中文字幕| 日韩精品电影一区亚洲| 国产激情偷乱视频一区二区三区| 成人的网站免费观看| 欧美巨大另类极品videosbest| 亚洲精品在线观| 亚洲美女精品一区| 久久成人免费电影| 色综合久久久久| 精品久久久久久无| 亚洲最快最全在线视频| 激情图片小说一区| 在线观看欧美黄色| 久久久久久黄色| 亚洲成a人v欧美综合天堂下载 | 日本午夜精品视频在线观看 | 亚洲伊人伊色伊影伊综合网| 老司机精品视频导航| 91小视频免费看| 欧美精品一区二区久久婷婷| 亚洲伦理在线免费看| 国产一区在线精品| 欧美丰满少妇xxxxx高潮对白| 中文字幕av一区 二区| 男男成人高潮片免费网站| a4yy欧美一区二区三区| xf在线a精品一区二区视频网站| 亚洲国产精品一区二区久久恐怖片| 国产传媒日韩欧美成人| 欧美一区二区啪啪| 一二三区精品视频| 成人动漫视频在线| 久久蜜桃av一区二区天堂| 午夜电影网亚洲视频| 91亚洲精华国产精华精华液| 久久精品欧美一区二区三区不卡| 香蕉影视欧美成人| 色综合 综合色| 国产精品视频你懂的| 精品亚洲aⅴ乱码一区二区三区| 欧美精品日韩一本| 亚洲一区二区三区在线播放| 97久久超碰国产精品电影| 国产日韩欧美高清在线| 激情六月婷婷综合| 精品国产三级a在线观看| 奇米精品一区二区三区四区| 欧美日韩一级大片网址| 亚洲制服丝袜在线| 欧美午夜一区二区三区| 一区二区视频在线| a在线播放不卡| 国产免费成人在线视频| 国产精品一二二区| 国产亚洲欧美色| 国产精品亚洲综合一区在线观看| 精品成人佐山爱一区二区| 久久国产成人午夜av影院| 日韩精品在线看片z| 久久成人综合网| 久久人人超碰精品| 国产成+人+日韩+欧美+亚洲| 久久精品夜色噜噜亚洲aⅴ| 激情深爱一区二区| 国产欧美一区视频| 波波电影院一区二区三区| 亚洲欧洲三级电影| 91成人网在线| 三级在线观看一区二区| 日韩一区二区在线看| 久久精品国产在热久久| 久久先锋资源网| 成人一区二区视频| 亚洲欧洲av另类| 欧美亚洲图片小说| 天堂一区二区在线| 精品国产伦一区二区三区观看方式 | 天天色图综合网| 日韩一级高清毛片| 国精产品一区一区三区mba视频| 久久久亚洲欧洲日产国码αv| 国产sm精品调教视频网站| 亚洲青青青在线视频| 欧美色精品在线视频| 久久国产尿小便嘘嘘| 国产欧美一区二区精品忘忧草| av在线不卡免费看| 亚洲va韩国va欧美va精品| 精品国产免费一区二区三区四区 | 国产一区二区三区在线观看免费| 久久久www免费人成精品| youjizz久久| 亚洲成a人v欧美综合天堂| 精品国产免费人成电影在线观看四季| 国产91精品免费| 亚洲国产人成综合网站| 精品久久久久久久久久久久久久久久久 | 激情综合色综合久久综合| 中文一区二区在线观看| 欧美写真视频网站| 国产福利精品一区二区| 一二三四区精品视频| 久久亚洲二区三区| 欧美日韩免费视频| 国产盗摄视频一区二区三区| 亚洲综合色视频| 欧美韩日一区二区三区| 欧美乱妇23p| www.成人网.com| 捆绑调教一区二区三区| ●精品国产综合乱码久久久久| 欧美一区在线视频| 99久久国产综合色|国产精品| 蜜桃免费网站一区二区三区| 中文字幕欧美一| 欧美精品一区二区在线观看| 94色蜜桃网一区二区三区| 久久成人久久鬼色| 亚洲午夜精品17c| 国产精品成人免费在线| 日韩一区二区三区视频| 欧美在线观看一二区| 成人免费电影视频| 狠狠色丁香婷婷综合久久片| 亚洲国产成人porn| 亚洲丝袜精品丝袜在线| 久久久不卡影院|