?? emeter_cfg.h
字號:
/********************************************************************************
* 杭州利爾達 *
* MSP430FE42X單相防竊電多功能電表平臺 *
* ----- ESP SD16實現 *
* *
* *
* 說明:本軟件為杭州利爾達單相防竊電多功能電表DEMO軟件 *
* *
*********************************************************************************/
#ifndef _EMETER_CFG_H_
#define _EMETER_CFG_H_
/* 定義能量產生方式為每秒更新一次,為預編譯用 */
//#define ENERGY_1SEC
#define STORE_IN_FLASH_NUM 38
#define ICON_DECIMAL_1 5
#define FIRST_POSITION 0
#define PHASE_POSITION 1
#define YEAR_POSITION 2
#define MONTH_POSITION 5
#define DAY_POSITION 7
#define HOUR_POSITION 2
#define MINUTE_POSITION 5
#define SECONDS_POSITION 7
/* LCD顯示數據長度 */
#define NUMBER_WIDTH 6
/* 定義各參數的LCD顯示小數個數 */
#define FREQUENCY_RESOLUTION 2
#define VOLTAGE_RESOLUTION 2
#define CURRENT_RESOLUTION 2
#define POWER_RESOLUTION 2
#define POWER_FACTOR_RESOLUTION 2
#define FALSE 0
#define TRUE 1
/* 定時器A中斷間隔 */
#define SAMPLE_PERIOD 8
#define CURRENT_CH1_Cz 0.0000270576
#define CURRENT_CH2_Cz 0.0000455807
#define CURRENT_CH1_100_Cz (CURRENT_CH1_Cz*100)
#define CURRENT_CH2_100_Cz (CURRENT_CH2_Cz*100)
#define CURRENT_CH1_10000_Cz (CURRENT_CH1_Cz*10000)
#define CURRENT_CH2_10000_Cz (CURRENT_CH2_Cz*10000)
// KI1 = 1.28/(16*65536*300E-6*1) = 0.00406901
#define CURRENT_CH1_KI1 0.00406901
// KI2 = (1000*1.28)/(1*65536*20*1) = 0.001373291
#define CURRENT_CH2_KI2 0.00437329
// KV1 = 991 * 1.28/65536 = 0.01935547
#define VOLTAGE_CH1_KV1 0.01935547
/* 脈沖常數 */
#define ENERGY_PULSES_PER_KW_HOUR 3200
#define ENERGY_WATT_HOUR_THRESHOLD (40960L*36000L)
#define ENERGY_PULSE_THRESHOLD (ENERGY_WATT_HOUR_THRESHOLD/ENERGY_PULSES_PER_KW_HOUR)*1000
#define ENERGY_PULSE_DURATION 200
#define ESP_IDLE modeIDLE
#define ESP_MEASURE modeMEASURE
#define mSET_NOMMAINSFREQ mSET_NOMFREQ
#define MCLK_FREQ 4
#define POW_2_14 0x004000
#define POW_2_20 0x100000
#define POW_2_16 0x010000
#define ERROR 43043
#define SD16CONF0_TWEAK 0xC0
#define SD16CONF1_TWEAK 0x40
/* 溫度采樣基本偏差 */
#define TEMPERATURE_OFFSET 2680
/* 溫度補償時間間隔 */
#define CORRECT_TIME 5
/* 晶體基本偏差(常溫下) */
#define CRYSTAL_BASE_CORRECTION 0
#define ADC_MIN -32767
#define ADC_MAX 32767
#define V_HISTORY_MASK 0x3
#define SAMPLES_PER_SECOND 1024//4096
#define ENDSTOP_HITS_FOR_OVERLOAD 20
/* These are the flags defined for the channel's status variable. */
#define V_POS 0x0001
#define I_POS 0x0002
#define ENERGY_LOGABLE 0x0004
#define NEW_LOG 0x0008
#define V_OVERRANGE 0x0010
#define I_OVERRANGE 0x0020
#define I_REVERSED 0x0040
#define I_NEUTRAL_OVERRANGE 0x0080
#define I_NEUTRAL_REVERSED 0x0100
#define CURRENT_FROM_NEUTRAL 0x0200
#define LIVE_ONLY_CONNECT 0x0400
#define I_NEUTRAL_POS 0x0800
#define PHASE_REVERSED 0x1000 /* Live, neutral or both leads */
#define PHASE_UNBALANCED 0x2000
#macro SET_ACT_PULSE_LED
P1SEL &= ~BIT2;
P1DIR |= BIT2;
P1OUT |= BIT2;
#endm
#macro SET_REACT_PULSE_LED
P1SEL &= ~BIT3;
P1DIR |= BIT3;
P1OUT |= ~BIT3;
#endm
#macro CLR_ACT_PULSE_LED
P1SEL &= ~BIT2;
P1DIR |= BIT2;
P1OUT &= ~BIT2;
#endm
#macro CLR_REACT_PULSE_LED
P1SEL &= ~BIT3;
P1DIR |= BIT3;
P1OUT &= ~BIT3;
#endm
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -