📄 parameter.h
字号:
// parameter.h
#include "device.h"
#ifndef IAR_KS
#define withUARTComm
#define withCalibration
#endif
#define withDisplay
#define LCD_TEST_PATTERN 1
#define withRS485
//#define shunt
#define ExtIntLevel
#define SUPRESS_WAKEUP_STRING
#ifndef __PI
#define __PI 3.141592653589793238462643
#endif
#define defSystemFreq 1024*4
#define defFlashFreq ((unsigned char)(((((float)defSystemFreq)/350)+1.5)) & 0x3f)
#ifdef shunt
#define defVRatio 11.917716
#define defIRatio 3.24823236
#define defEnergieRatio 38.7115097 /*(defVRatio * defIRatio)*/
#else
#define defVRatio 11.9251308
#define defIRatio 3.54233074
#define defEnergieRatio 37.9404411 /*(defVRatio * defIRatio)*/
#endif
// =========== COUNTRY SELECTION TABLE =============
// This table is neither complete nor guaranteed to be accurate.
// Please verify the settings for your country before use.
#define EUROPE 100
#define GERMANY EUROPE
#define UK EUROPE
#define NORTH_AMERICA 200
#define USA NORTH_AMERICA
#define CANADA NORTH_AMERICA
#define MEXICO NORTH_AMERICA
#define ASIA 400
#define CHINA ASIA
#define HONGKONG ASIA
#define JAPAN_EAST 440
#define JAPAN_WEST 441
#define TAIWAN NORTH_AMERICA
#define OCEANIA ASIA
#define LOCATION USA //<== CHOOSE YOUR COUNTRY HERE
// ----- Set Date Format for Display -----
#if LOCATION == NORTH_AMERICA
#define date_format MMDDYY
#else
#define data_format DDMMYY
#endif
// ----- Set Line Voltage and Frequency -----
#if LOCATION == EUROPE
#define defSET_NOMVOLTAGE 230
#define defSET_NOMFREQ 50
#elif LOCATION == NORTH_AMERICA
#define defSET_NOMVOLTAGE 120
#define defSET_NOMFREQ 60
#elif LOCATION == ASIA
#define calVoltage 220
#define defSET_NOMFREQ 50
#elif LOCATION == JAPAN_EAST
#define defSET_NOMVOLTAGE 100
#define defSET_NOMFREQ 50
#elif LOCATION == JAPAN_WEST
#define defSET_NOMVOLTAGE 100
#define defSET_NOMFREQ 60
#else // Default
#define defSET_NOMVOLTAGE 220
#define defSET_NOMFREQ 50
#endif
// * \par Nominal Mains Frequency:
//#define defSET_NOMFREQ 50
//#define defSET_NOMFREQ 60
//#define calFreq defSET_NOMFREQ
#define defSET_CALVOLTAGE defSET_NOMVOLTAGE
#define defSET_CALCURRENT 10.0
//#define calCurrent 10
#define calPhi 60
#define calCosPhi 0.5
//// Set ADC gain based on nominal supply voltage
//#if calVoltage <= 125
// #define V_Gain GAIN_2
//#else
// #define V_Gain GAIN_1
//#endif
#ifdef shunt
#define I1_Gain GAIN_32
#define I2_Gain GAIN_1
#else
#define I1_Gain GAIN_1
#define I2_Gain GAIN_1
#endif
// Set event message request flags:
#define defSET_EVENT \
0 * WFSRDYME + /* Interrupt on "New WFS"*/\
0 * I2GTI1ME + /* Interrupt on "I2GTI1"*/\
0 * ILREACHEDME + /* Interrupt on "Interrupt Level reached"*/\
1 * ENRDYME + /* Interrupt on "Energy samples ready (1sec)"*/\
1 * ZXLDME + /* Interrupt on "leading zero cross"*/\
1 * ZXTRME + /* Interrupt on "trailing zero cross"*/\
0 * CALRDYME /* Interrupt on "Calibration Data ready"*/
/**
* \ OFFSET for U, I1, I2
*/
#ifdef shunt
#define defSET_V1OFFSET (0)
#define defSET_I1OFFSET (0)
#define defSET_I2OFFSET (0)
#else
#define defSET_V1OFFSET (0)
#define defSET_I1OFFSET (-4)
#define defSET_I2OFFSET (0)
#endif
/**
* \example for Phase Error Correction:
* Sets phase error for current 2 at nominal mains frequency for
* current transformer according to its specification
* (e.g. T60404-E4623-X101 from VAC (http://www.vacuumschmelze.com)).
* - Turn ratio: 2500
* - Burden resistor: RB = 18.8Ohm
* - Phase error at 50Hz: 4.15
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -