Files
CHJ/user/Main/Macro_Flange.h

594 lines
29 KiB
C
Raw Normal View History

2026-03-20 21:16:58 +08:00
/********************************************************************************************************
** DP1902 MFXXGD FLANGE IO<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>
**
** Copyright (c) Siargo, Ltd. 2011
** All Rights Reserved.
**
**-------------------------------------------------------------------------------------------------------
********************************************************************************************************/
//#ifndef __DP1703_TFS7306_M0_V10_Flange_h__
//#define __DP1703_TFS7306_M0_V10_Flange_h__
#ifndef __MACRO_FLANGE_H__
#define __MACRO_FLANGE_H__
//==============================================16================================
#define PROGRAM_I2C_DEBUG 1
//==============================================================================
#define PRODUCT_MOD "FS5001-H2"
#define VER_MV 2
#define VER_SV 0
#define VER_RV 2
#define VER_BV 5
#define BUILD_MV "20250901" //build日期
#define VERSION "2025.250901" //软件版本
//#define SOFT_VERSION 2025 //软件版本
/*******************************************************************************
*******************************************************************************/
// Microcontroller operating frequency
#define FREQ 4000000//((8000000/32768))*32768 // system frequency definition
#define TIMER_FREQ 32768
#define ACLK_DIV DIVA__1
#define SMCLK_DIV DIVS__2
#define MCLK_DIV DIVM__1
//******************************************************************************
// Function selection
//******************************************************************************
//******************************************************************************
#define DP0000_FS5001_H2 0
2026-03-20 21:19:53 +08:00
#define DP2201_M0CONTROL 1
2026-03-20 21:16:58 +08:00
//******************************************************************************
#define ENABLE_DCOEF 1 //?
#define ENABLE_LOWPOWER_MODE 1
//------------------------------------------------------------------------------
#define ENABLE_TURN_OFF_RH_TEST 1 //?
#define ENABLE_AUTO_CALIB_ATYPE_OFFSET 1 //?
//------------------------------------------------------------------------------
// for ACC Compute
#define REC_ACC_PER 1 // Acc flowrate save enable bit
#define ENABLE_ACCPULSE 1 // <20><><EFBFBD><EFBFBD>ܺ<EFBFBD><DCBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㲥ͬʱʹ<CAB1><CAB9>
#define ENABLE_PULSE_USE_CALIB_SETUP 0
//------------------------------------------------------------------------------
// For data storage
#define REC_ALARM_DATA 1 // for alarm data save enable bit
#define REC_DATE_DATA 1 // for date acc data save enable bit
#define REC_HISTORY_DATA 1 // for history data save enable bit
//------------------------------------------------------------------------------
// For Display
#define ENABLE_USE_GDT0136 0
#define ENABLE_EMD779103D 0 // if ENABLE_EMD779103D = 1, ENABLE_EMD779106D = 0
#define ENABLE_EMD779106D 0
#define ENABLE_EDC20063HDC1P4 0
#define ENABLE_EDC20021HDC1P8 0
#define ENABLE_USE_EDM7791 (ENABLE_EMD779103D | ENABLE_EMD779106D)
#define ENABLE_EDM7791_ALL (ENABLE_EMD779103D & ENABLE_EMD779106D)
#define ENABLE_LCD_DISPLAY (ENABLE_USE_EDM7791 | ENABLE_USE_GDT0136 |ENABLE_EDC20063HDC1P4 | ENABLE_EDC20021HDC1P8)
// for GDT0136 LCD
#define ENABLE_DISPLAY_FR_FLAG 0
#define ENABLE_DISPLAY_ACC 0
//------------------------------------------------------------------------------
// For KEY SETUP
#define ENABLE_KEY 0
#define ENABLE_KEY_FUNCTION (ENABLE_KEY & ENABLE_LCD_DISPLAY)
// for Key Operation
#define ENABLE_ALTERNATE_DISPLAY 0
#define ENABLE_KEY_FOR_LCD_SWAP 0
#define ENABLE_KEY_FOR_FAST_OFFSET 0
#define ENABLE_KEY_FOR_BPS 0
#define ENABLE_KEY_FOR_OFFSET 0
#define ENABLE_KEY_FOR_OFFSET_NEED_PASSWORD 0
#define ENABLE_KEY_FOR_GCF 0
#define ENABLE_KEY_FOR_METERFACTOR 0
#define ENABLE_KEY_FOR_DCOEF 0
#define ENABLE_KEY_FOR_MAXFLOWRATE 0
#define ENABLE_KEY_FOR_RESPONSE 0
#define ENABLE_PLUG_IN_FLOWRATE 0
#define ENABLE_KEY_FOR_ACC_UNIT 0
#define ENABLE_KEY_FOR_FLOWRATE_UNIT 0
#define ENABLE_KEY_FOR_LANGUAGE 0
#define ENABLE_KEY_FOR_PULSE 0
#define ENABLE_KEY_FOR_ALARM_FR 0
#define ENABLE_KEY_FOR_PASSWORD 0
#define ENABLE_KEY_FOR_CLR_ACC 0
#define ENABLE_KEY_FOR_RESET_DCOEF 0
//------------------------------------------------------------------------------
#define ENABLE_EXT_RTC 0
#define ENABLE_EXT_CRYSTAL 1
//------------------------------------------------------------------------------
// For pressure test
#define ENABLE_USE_MS5837 0
#define ENABLE_PRESSURE ENABLE_USE_MS5837
#define ENABLE_PRESSURE_TEMPERATURE ENABLE_USE_MS5837
//------------------------------------------------------------------------------
// For 4-20mA Analog output
#define ENABLE_USE_SPI2 0
#define ENABLE_USE_SPI2SOMI 0
#define ENABLE_USE_DACSOMI 0
#define ENABLE_USE_DAC8760 0
#define ENABLE_USE_AD5420 0
#define ENABLE_4_20MA_OUTPUT (ENABLE_USE_DAC8760 | ENABLE_USE_AD5420)
#define ENABLE_4_20MA_ALL (ENABLE_USE_DAC8760 & ENABLE_USE_AD5420)
//------------------------------------------------------------------------------
// for sampling flowrate
#define ENABLE_USE_DAC8550 0
//------------------------------------------------------------------------------
// For User UART & I2C
#define ENABLE_USER_I2C 0
#define ENABLE_USER_UART 1
#define ENABLE_TXD_USE_DMA 0
#define ENABLE_USE_TXD_EN 0
#define ENABLE_TURN_OFF_RS485 0
#define ENABLE_DIGITAL_OUTPUT 0
#define ENABLE_FACTORY_PROTOCOL 0
//------------------------------------------------------------------------------
// for bluetooth beacon mode
#define BLUETOOTH_MODE 0
#define ENABLE_BLUETOOTH_BEACON (BLUETOOTH_MODE & (!ENABLE_ACCPULSE))
//------------------------------------------------------------------------------
#define ENABLE_NBIOT 0
//------------------------------------------------------------------------------
#define ENABLE_RF_UART (ENABLE_NBIOT | ENABLE_BLUETOOTH_BEACON) // RF Uart: NBIOT, Blue
#define ENABLE_RF_RX 0
#define ENABLE_AUTO_FOR_RF_TX 0 // for : INTER-NBIOT MOD
#define ENABLE_AUTO_USER_UART_TX 0
#define ENABLE_ERROR_USE_RF_TXDPIN 0
#define ENABLE_ERROR_PIN_FOR_VALVE_CONTROL 0
#define ENABLE_LEAK_DETECT 0
#define ENABLE_AT_FOR_MASTER_UART (ENABLE_RF_UART)
#define ENABLE_DENSITY_DETECT 0
#define ENABLE_ACC_GAIN 0
//------------------------------------------------------------------------------
// FOR D6V2
#define ENABLE_USE_ATYPE_DCP 0
#define ENABLE_USE_CTYPE_DCP 0
#define POT_INC_AND_VALUE_DEC 0
#define ENABLE_ATYPE_ALARM 0
// ONLY SELECT ONE
#define ENABLE_USE_MCP4531 0
#define ENABLE_USE_CAT5171 1
#define ENABLE_USE_TPL0501 0
// RH Contol circuit
#define ENABLE_RATIO_HIGH 0
//------------------------------------------------------------------------------
// For A-Type FlowRate Compute
#define ENABLE_A_TYPE_FLOWRATE 0
#define ENABLE_PLUG_IN_FLOWRATE 0
//------------------------------------------------------------------------------
// For Temperature test
#define ENABLE_USE_MCP9808 1
//------------------------------------------------------------------------------
// For Temperature correction
#define ENABLE_OFFSET_TRACK 0 //track<63><6B><EFBFBD><EFBFBD>
#define ENABLE_OFFSET_CORRECT 1 //ƫ<><C6AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define ENABLE_AUTO_ZERO_TRACK 0
#define ENABLE_TD_TU_SWITCH_CONTROL 0
#define ENABLE_MULTI_PONIT_TA_CORR 1
// For D9V2 if TEMP_CORR_USE_TA = 0 & TEMP_CORR_USE_RR = 0, use TGAS
#define TEMP_CORR_USE_TA 0 // TPCB
#define TEMP_CORR_USE_RR 0
//------------------------------------------------------------------------------
#define ENABLE_GAS_RECOGNITION 1
#define ENABLE_GAS_RECOGNITION_TABLE 1
#define ENABLE_RR_CALIBRATION ENABLE_GAS_RECOGNITION
#define ENABLE_ONE_TABLE 0
#define ENABLE_ONE_TABLE_NAME INTCMD_1ST_TABLE
//------------------------------------------------------------------------------
// for calibration data У׼<D0A3><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define ENABLE_ONE_CURVE 1
#define ENABLE_2ND_CURVE 0
#define ENABLE_3RD_CURVE 0
//------------------------------------------------------------------------------
#define ENABLE_HALT_IN_OPERATE_CURVE 1
//------------------------------------------------------------------------------
// For ADC Calibration
#define ENABLE_CALIB_ATYPE_ADC 0
//------------------------------------------------------------------------------
#define ENABLE_EXTPOWER_DETECT 0
#define DISABLE_BAT_ALARM_IN_EXPOWER 0
#define DISABLE_BAT_ALARM 1
#define ENABLE_DEBUG_PIN 0 // if Not<6F><74>use for RF Control pin
#define ENABLE_ZERO_CALIB 1
#define ENABLE_ZERO_CALIB_PIN 0 // if Not<6F><74>use for RF Control pin
#define ENABLE_ZERO_CALIB_CMD 1
#define ENABLE_CALPIN_FOR_UPDATE_FR 1
//------------------------------------------------------------------------------
// for internal modbus
#define ENABLE_READ_CODE_INTO_CALIB 0
//------------------------------------------------------------------------------
// for SELECT BAT
#define ENABLE_BAT_SEL_PIN 0 // use for RF Control pin
//------------------------------------------------------------------------------
// FOR FLOWRATE UNIT
#define ENABLE_SCCM_SL 0
#define ENABLE_SLPM_NM3 1
#define ENABLE_NCMH_NM3 1
#define ENABLE_SCFM_SCF 0
#define ENABLE_PPM_PPM 0
#define ENABLE_KGH_KG 0
#define ENABLE_SLPM_SL 0
#define ENABLE_SCFH_SCF 1
#define ENABLE_FIXED_UART_FR 0
#define WORK_UNIT_DEFAULT NCMH_NM3 // SCFH_SCF
#define FR_STD_UNIT SLPM // NCMH
//------------------------------------------------------------------------------
#define ACC_INT_8BIT 1
#define ACC_INT_7BIT 0
#define ACC_INT_6BIT (ENABLE_USE_GDT0136 | ENABLE_EDC20021HDC1P8)
#define ENABLE_ACC_DEC_COMPUTE 0
//------------------------------------------------------------------------------
#define ENABLE_SAMPLE_GREATER_GAIN 1
//------------------------------------------------------------------------------
#define ENABLE_FLOW_GAIN 1
#define FLOW_GAIN_DEFAULT 100
#define FLOW_GAIN_MAX 1000
//------------------------------------------------------------------------------
// for user protocol
#define ENABLE_USER_WP 1 // Write protect
#define ENABLE_USER_GCF 1
#define ENABLE_USER_OFFSET 1
#define ENABLE_USER_WRITE_ACC 1
#define ENABLE_USER_RESET_CORR 1
#define ENABLE_USER_SET_UNIT 1
#define ENABLE_ALARM_ACC 0
//------------------------------------------------------------------------------
#define ENABLE_ADJUST_ADC_GAIN 1
//******************************************************************************
#define TURN_OFF_SYSTEM 245 // 2.45V
//******************************************************************************
// Parameter default
//******************************************************************************
// FOR MODBUS Define
// MODBUS Operation password
#define COM_PASSWORD1 0x53495244 //0x53495244 "SIRD"
#define COM_PASSWORD2 0x32303133
#define COM_PASSWORD3 0x53494152
// for MODBUS Default
#define MAP1_DEFAULT STD_PROTOCOL
#define MAP2_DEFAULT STD_SLAVER_ID
#define MAP3_DEFAULT STD_FLOWRATE
#define MAP4_DEFAULT (STD_FLOWRATE+1)
#define MAP5_DEFAULT STD_ACC_INT
#define MAP6_DEFAULT (STD_ACC_INT+1)
#define MAP7_DEFAULT STD_ACC_DOT
#define MAP8_DEFAULT (STD_METER_SN)
#define MAP9_DEFAULT (STD_METER_SN+1)
#define MAP10_DEFAULT (STD_METER_SN+2)
#define MAP11_DEFAULT (STD_METER_SN+3)
#define MAP12_DEFAULT (STD_METER_SN+4)
#define MAP13_DEFAULT (STD_METER_SN+5)
#define MAP14_DEFAULT STD_ALARM_1
#define MAP15_DEFAULT STD_BAT1_V
#define MAP16_DEFAULT STD_OUT_FR_MAX
#define MAP17_DEFAULT (STD_OUT_FR_MAX+1)
#define MAP18_DEFAULT STD_OUT_FR_MAX
#define MAP19_DEFAULT (STD_OUT_FR_MAX+1)
#define MAP20_DEFAULT STD_GAS_OFFSET_C
#define MAP21_DEFAULT STD_GAS_OFFSET_A
#define MAP22_DEFAULT STD_TA
#define MAP23_DEFAULT STD_TGAS
#define MAP24_DEFAULT STD_GAS_FACTOR
#define MAP25_DEFAULT STD_AIR_FACTOR
#define MAP26_DEFAULT STD_FACTOR_VTH
#define MAP27_DEFAULT 0
#define MAP28_DEFAULT 0
#define MAP29_DEFAULT 0
#define MAP30_DEFAULT 0
#define MAP31_DEFAULT 0
#define MAP32_DEFAULT 0
#define MAP33_DEFAULT 0
#define MAP34_DEFAULT 0
#define MAP35_DEFAULT 0
#define MAP36_DEFAULT 0
#define MAP37_DEFAULT 0
#define MAP38_DEFAULT 0
#define MAP39_DEFAULT 0
#define MAP40_DEFAULT 0
#define MAP41_DEFAULT 0
#define MAP42_DEFAULT 0
#define MAP43_DEFAULT 0
#define MAP44_DEFAULT 0
#define MAP45_DEFAULT 0
#define MAP46_DEFAULT 0
#define MAP47_DEFAULT 0
#define MAP48_DEFAULT 0
//------------------------------------------------------------------------------
// FOR AUTO TXD DATA
#define TIMING_TXD_START_DEFAULT STD_METER_SN
#define TIMING_TXD_LEN_DEFAULT (STD_BAT1_V - STD_METER_SN)+1
#define TIMING_TXD_TIME_DEFAULT 0
//------------------------------------------------------------------------------
#define DIS_LANGUAGE_DEFAULT CHINESE
//------------------------------------------------------------------------------
#define KEY_PASSWORD_DEFAULT 11111
//******************************************************************************
//------------------------------------------------------------------------------
#define MAX_ALRAM_FR_DEFAULT 160 // 1.25*128
//------------------------------------------------------------------------------
// INSTRUMENT_FACTOR = 1 ERROR_CORRECT = 0
#define CORRECT_METHOD ERROR_CORRECT
#define ENABLE_GCF_POWER_CORR 0
//------------------------------------------------------------------------------
#define METER_PARAMETER_STD 1000
#define METER_PARAMETER_DEFAULT 1000
#define METER_PARAMETER_MAX 6500
#define METER_PARAMETER_MIN 112
//------------------------------------------------------------------------------
#define GCF_PARAMETER_STD 1000
#define GCF_PARAMETER_MAX 5500
#define GCF_PARAMETER_MIN 250
#define GCF_ATYPE_DEFAULT 850
//------------------------------------------------------------------------------
#if(ENABLE_GCF_POWER_CORR)
//------------------------------------------------------------------------------
#define GCF_DEFAULT 889
#define GCF_A_DEFAULT -46
#define GCF_C_DEFAULT 226
#define GCF_A_DOT 1000
#define GCF_B_DOT 1000
#define GCF_C_DOT 1000000 // for mm2 No dot bit
//------------------------------------------------------------------------------
#else
//------------------------------------------------------------------------------
#if(DP1902COREV0134)
#define GCF_DEFAULT 850
#else
#define GCF_DEFAULT 1030
#endif
//----------------------------------------------------------------------------
#define GCF_A_DEFAULT 0
#define GCF_C_DEFAULT 0
#define GCF_A_DOT 10000000000
#define GCF_B_DOT 1000
#define GCF_C_DOT 10000
//------------------------------------------------------------------------------
#endif
//------------------------------------------------------------------------------
#define TIMING_TXD_START_MAX STD_WRITE_START
#define TIMING_TXD_START_MIN STD_REG_START
#define TIMING_TXD_LEN_MAX 40
#define TIMING_TXD_LEN_MIN 1
#define TIMING_TXD_TIME_MAX 45000 //
//------------------------------------------------------------------------------
#define SAMPLE_PERIOD_MAX RESP_4000MS
#define SAMPLE_PERIOD_MIN RESP_125MS // RESP_500MS
#define SAMPLE_PERIOD_DEFAULT RESP_125MS // RESP_4000MS
#define EXT_POWER_PERIOD_TIME RESP_125MS // RESP_500MS //<2F>ⲿ<EFBFBD><E2B2BF>Դ
//------------------------------------------------------------------------------
#define RESPONSE_TIME_DEFAULT RESP_2000MS // 125, 250, 500, 1000, 2000, 4000
#define ENABLE_DISPLAY_FILTER 1
#define DISPLAY_FILTER_DEFAULT RESP_1000MS // 1S
#define FLOWRATE_UPDATE_SCALE 18 // 50/1024= 5%
#define FRINDEX_UPDATE_SCALE 8 // 50/1024= 5%
//------------------------------------------------------------------------------
#define CALIB_PULSE_DEFAULT PULSE_1ML
#define CALIB_PULSE_UNIT_MIN PULSE_1ML
#define CALIB_PULSE_UNIT_MAX PULSE_1000L
#define PULSE_LEVEL_DEFAULT LOW
#define PULSE_UNIT_DEFAULT PULSE_1000L
#define PULSE_UNIT_MIN PULSE_100ML
#define PULSE_UNIT_MAX PULSE_1000L
//for key setup
#define PULSE_UNIT_INDEX_MIN PULSE_100ML_INDEX
#define PULSE_UNIT_INDEX_MAX PULSE_1000L_INDEX
//------------------------------------------------------------------------------
#define COM_DECIMAL_POINT_DEFAULT 3
//------------------------------------------------------------------------------
#define MAX_FR_DEFAULT 600000
#define MIN_FR_DEFAULT 0
#define CLIAB_STD_FR_GIAN 1 // <20><>ԭ<EFBFBD><D4AD>1000<30>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//------------------------------------------------------------------------------
#define ADC_GAIN_DEFAULT 32
//------------------------------------------------------------------------------
// for AType FlowRate Compute
#define SDT_ZERO_OFFSET 20000
#define OFFSET_A_MAX 30000
#define OFFSET_A_MIN 10000
#define AUTO_OFFSET_NIDX 150
#define AUTO_OFFSET_NVHH 5000
#define SWITCH_FR_DEFAULT 20000
#define SWITCH_FR_INDEX_MAX 30000
#define SWITCH_FR_INDEX_MIN 1000
#define ATYPE_INDEX_GAIN_DEFAULT 30
#define ATYPE_INDEX_GAIN_MAX 100
#define ATYPE_INDEX_GAIN_MIN 10
//------------------------------------------------------------------------------
#define TEMPRETURE_OFFSET 10000 // 2bit
#define FR_TEMPERATURE_DEAULT 2000
#define TEMPERATURE_K_STD 27315
#define FR_TEMPERATURE_STD 29315 // 273.15 + 20.00
//------------------------------------------------------------------------------
#define ENABLE_WRITE_TA_HIGH (TEMPRETURE_OFFSET+4750)
#define ENABLE_WRITE_TA_LOW (TEMPRETURE_OFFSET+150)
#define ENABLE_WRITE_TA_SCALE 150 // 1.5<EFBFBD><EFBFBD>C
#define TEMP_FACTOR_MAX 50 // 0.005
#define TEMP_FACTOR_MIN 0 //-0.005
#define TEMP_FACTOR_DEFAULT 25 //-0.0025
//------------------------------------------------------------------------------
#define STATIC_LOW_TA_MAX 11000 // 10<31><30>C
#define STATIC_LOW_TA_MIN 8000 // -20<32><30>C
#define STATIC_HIGH_TA_MAX 17000 // 70<37><30>C
#define STATIC_HIGH_TA_MIN 14000 // 40<34><30>C
//------------------------------------------------------------------------------
#define TGAS_ALARM_MAX 17000 // 70<37><30>C
#define TGAS_ALARM_MIN 5000 // -50<35><30>C
//------------------------------------------------------------------------------
#define CALIB_TEMPRETURE_MAX 13500
#define CALIB_TEMPRETURE_MIN 11500
//------------------------------------------------------------------------------
#define ZERO_SUPPRESSION_DEFAULT 150
#define ZERO_SUPPRESSION_MAX 2000
#define ZERO_SUPPRESSION_MIN 0
//------------------------------------------------------------------------------
#define OFFSET_MAX 36768
#define OFFSET_MIN 28768
//------------------------------------------------------------------------------
#define REVERSE_SCALE_DEFAULT 3000
#define REVERSE_SCALE_MAX 16000
#define REVERSE_SCALE_MIN 300
//------------------------------------------------------------------------------
#define CURVE_DATA_MAX 36
#define TACURVE_NUM_DEFAULT 0
#define CURVE_NUM_MAX CURVE_DATA_MAX
#define CURVE_NUM_MIN 0
#define ATYPECURVE_NUM_DEFAULT 0
#define ATYPECURVE_NUM_MAX CURVE_DATA_MAX
#define ATYPECURVE_NUM_MIN 0
//------------------------------------------------------------------------------
#define RR_GAINRES_DEFAULT 7500
#define RR_GAINRES_MAX 62000
#define RR_GAINRES_MIN 10000
#define RR_OPGAIN_RES 33000.0
//------------------------------------------------------------------------------
#define VHH_AIR_PARA_DEFAULT 32768
#define VHH_AIR_PARA_MAX 50768
#define VHH_AIR_PARA_MIN 14768
#define VHH_PARA_SCALE_DEFAULT 1000
#define VHH_PARA_SCALE_MAX 10000
#define VHH_PARA_SCALE_MIN 100
//------------------------------------------------------------------------------
#define SLAVER_ADDR_DEFAULT 1
//------------------------------------------------------------------------------
#define HISTORY_PERIOD_DEFAULT 60
//------------------------------------------------------------------------------
#define BATTEST_PERIOD_DEFAULT 120
//------------------------------------------------------------------------------
#define RH_GAINRES_DEFAULT 25
//------------------------------------------------------------------------------
#define DAC8760 0
#define AD5420 1
#define SYS_LOOP_CHIP_DEFAULT DAC8760
#define SYS_LOOP_CHIP_MIN DAC8760
#define SYS_LOOP_CHIP_MAX AD5420
//------------------------------------------------------------------------------
#define EDM779106D 0
#define EDM779103D 1
#define SYS_LCD_DEFAULT EDM779106D
#define SYS_LCD_MIN EDM779106D
#define SYS_LCD_MAX EDM779103D
//******************************************************************************
//#define DATA_COMP_FAC CALIB_COMP_FAC // compression factor for calibration data board code
//#define CALIB_WIDTH 64 //固定宽度64字节 由于Flash每次最少写入4字节对该值应当有限制
#define MAX_OPERATE_DEPTH (CALIB_DEPTH/CALIB_COMP_FAC)
#define MAX_INDEX 8192 //MAX_OPERATE_DEPTH*CALIB_WIDTH
#define MAX_SPACE ((CALIB_WIDTH/CALIB_COMP_FAC)*CALIB_DEPTH)
#define CALI_DATA1_ADDR CALI_DATA_ADDR
// for calibration VHH
//#define DATA_COMP_FAC2 8 // compression factor for calibration data board code
//#define CALIB_DEPTH2 720
//#define MAX_OPERATE_DEPTH2 (CALIB_DEPTH2/DATA_COMP_FAC2)
//#define CALI_DATA2_ADDR 0x7000
//#define MAX_INDEX2 24000
// for calibration A Type FlowRate
#define DATA_COMP_FAC3 6 // compression factor for calibration data board code
#define CALIB_DEPTH3 720
#define MAX_OPERATE_DEPTH3 (CALIB_DEPTH3/DATA_COMP_FAC3)
#define CALI_DATA3_ADDR (((MAX_SPACE + CALI_DATA1_ADDR) & 0xff00) + 0x0100)
//#define CALI_DATA3_ADDR 0x7000 //0xA000
#define MAX_INDEX3 8192
#define INT_3RD_CURVE_CMD INTCMD_MICROFR_CURVE
#define CTYPE_FR CURVE_1ST
#define ATYPE_VH CURVE_2ND
#define CTYPE_GAINX CURVE_3RD
#define INT_2RD_CURVE_CMD INTCMD_ATYPE_CURVE
#define INT_3RD_CURVE_CMD INTCMD_MICROFR_CURVE
//==============================================================================
//==============================================================================
// LOW_POWER key intput interrupt, SW1=P1.5, SW3=P1.3
#define KEY_SEL P1SEL
#define KEY_DIR P1DIR
#define KEY_OUT P1OUT
#define KEY_REN P1REN
#define KEY_IN P1IN
#define KEY_IES P1IES
#define KEY_IFG P1IFG
#define KEY_IE P1IE
#define KEY_IV P1IV
//#define KEY_PIN (BIT5+BIT6+BIT7)
#define KEY_PIN (BIT4+BIT6+BIT7)
#define FUN_KEY_VECTOR BIT6_VECTOR
#define UPPER_KEY_VECTOR BIT7_VECTOR
//#define SHIFT_KEY_VECTOR BIT5_VECTOR
#define SHIFT_KEY_VECTOR BIT4_VECTOR
#define KEY_VECTOR PORT1_VECTOR
//--------------------------------------------------------------
#define KEY_PULLUP() (KEY_REN |= KEY_PIN)
#define KEY_INPUT() (KEY_DIR &= ~KEY_PIN)
#define SET_KEY() (KEY_OUT |= KEY_PIN)
#define READ_KEY_VALUE() (KEY_IN & KEY_PIN)
//--------------------------------------------------------------
#define FUN_KEY BIT6
#define UPPER_KEY BIT4 //BIT5
#define SHIFT_KEY BIT7
#define LONG_KEY 0x01
#define M_KEY FUN_KEY
#define INC_KEY UPPER_KEY
#define DEC_KEY SHIFT_KEY
#define LONG_M_KEY (M_KEY + LONG_KEY)
#define LONG_DEC_KEY (DEC_KEY + LONG_KEY)
#define LONG_INC_KEY (INC_KEY + LONG_KEY)
#define COMBO_KEY (INC_KEY + DEC_KEY)
#define M_KEY_VECTOR FUN_KEY_VECTOR
#define INC_KEY_VECTOR UPPER_KEY_VECTOR
#define DEC_KEY_VECTOR SHIFT_KEY_VECTOR//--------------------------------------------------------------
//******************************************************************************
#endif