⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 options.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: 71M652x POWER METER - Compile-time OPTIONS.
// 
//  AUTHOR:  RGV/MTF
//
//  HISTORY: See end of file
//**************************************************************************
// File: OPTIONS.H
//**************************************************************************
//  Compile time option switches.
//
#ifndef OPTIONS_H
#define OPTIONS_H       1

#include "stdint.h"

#define M6520   1
#define M6520H  1
#define M6521B  0
#define M6521D  0
#define M6521F  1
#define TRACE10  0
#define TRACE10H 0
#define TRACE11  0
#define TRACE13  0

#define XTAL_FREQ 32768

// Define characteristics of Meter.     // Phase A          | Phase B           | Phase C
#define _1ELEMENT_2WIRE         0x00    // VA IA            | VA IB             | N/A
#define _1ELEMENT_3WIRE         0x20    // VA (IA - IB)/ 2  | N/A               | N/A            
#define _2ELEMENT_3WIRE_DELTA   0x40    // VA IA            | VB IB             | N/A
#define _2ELEMENT_4WIRE_DELTA   0x60    // VA (IA - IB)/ 2  | N/A               | VC IC 
#define _2ELEMENT_4WIRE_WYE     0x80    // VA (IA - IB)/ 2  | VB (IC - IB)/ 2   | N/A
#define _3ELEMENT_4WIRE_WYE     0xA0    // VA IA            | VB IB             | VC IC

#ifndef EQUATION
#define EQUATION _1ELEMENT_2WIRE // default equation
#endif
#define PHASE_A_PRESENT        1
#define PHASE_B_PRESENT    (EQUATION == _1ELEMENT_2WIRE       || EQUATION == _2ELEMENT_3WIRE_DELTA || \
                         EQUATION == _2ELEMENT_4WIRE_WYE   || EQUATION == _3ELEMENT_4WIRE_WYE)
#define PHASE_C_PRESENT    (EQUATION == _2ELEMENT_4WIRE_DELTA || EQUATION == _3ELEMENT_4WIRE_WYE)

#define IMAX2               1           // Element 1 has a differently-scaled current sensor
// Use this value when the meter is powered only from element A (as in the demo PCB)
#define POWERED_PHASE       0x02        // which sag bit(s) to check
// Use this value when the meter is powered from element A and B
// #define POWERED_PHASE       0x06        // which sag bit(s) to check

#define VIM808              1           // Use VIM808 LCD.
#define DGM0915_HTN         0           // Use DGM0915 HTN LCD.
#define DEMAND              0           // Enable display of demand.
#define WATT_ELEMENT        1           // Measure WATT hours.
#define VAR_ELEMENT         1           // Measure VAR hours.
#define VA_ELEMENT          0           // Measure VA hours.
#if EQUATION < _2ELEMENT_3WIRE_DELTA
#define WATT_SUMS           0           // Measure WATT hours, sums of all phases.
#define VAR_SUMS            0           // Measure VAR hours, sums of all phases.
#define VA_SUMS             0           // Measure VA hours, sums of all phases.
#define SUMS                0           // Measure Watt, VAR and VA hour sums.
#else
#define WATT_SUMS           1           // Measure WATT hours, sums of all phases.
#define VAR_SUMS            1           // Measure VAR hours, sums of all phases.
#define VA_SUMS             1           // Measure VA hours, sums of all phases.
#define SUMS                1           // Measure Watt, VAR and VA hour sums.
#endif

#define IMPORT              1           // Measure imported energy
#define EXPORT              1           // Measure exported energy
#define ABS_VALUE           1           // Absolute value metering (resists tampers)
#define NET_METER           0           // Net energy metering

#define ISQ_SUMS            1           // Measure I^2 sums.
#define VSQ_SUMS            1           // Measure V^2 sums.

#define PEAKS               1           // Alert on voltage/current peaks.
#define RMS_VALUES          1           // Maintain voltage/current RMS values.
#define POWER_FACTOR        1           // Maintain power factor for element
#define PHASE_ANGLES        0           // Maintain voltage/current phase angles.
#define VOLTAGE_PHASES      0           // Maintain voltage phases (multiple voltages needed- see equation, above).

#define TEMPERATURE         1           // Maintain temperature.
#define FREQUENCY           1           // Maintain (measure) frequency.
//#define LINE_FREQ           50          // Not needed if frequency is measured
#define LINE_FREQ           60          // Not needed if frequency is measured
#define MAIN_EDGE_COUNT     1           // Maintain main edge count.
#define STATUS              1           // Maintain status.
#define OPERATING_TIME      0           // Maintain operating time.
#define REAL_TIME_DATE      1           // Maintain real time & date.
#define MODE_DISPLAY        1           // Number explaining LCD value
#define TAMPER_RESISTANT    0           // Resists tampering

#define CAL_SAVE           1            // save/restore calibration
#define AUTOCAL            0            // self-calibration
#define ADC_COMPENSATION   1            // auto-temperature compensation of ADC.
#define RTC_COMPENSATION   1            // Temperature compensation of RTC.
#define RTC_LINE_LOCKED    0            // RTC locked to line via edge count.
#define ENHANCED_TRIM      0            // Calibrate H-series parts

#define PULSE_SOURCE       1            // Select pulse sources.
#define PULSE_CNT          0            // Count pulses of LEDs
#define PULSE_SOFT         0            // add software-generated pulse outputs
#define ERROR_RECORDING    0            // error recording

#define CREEP_ENABLE       1
#define LCD_ACTIVE         1
#define WATCHDOG           0            // Enable watchdog hierarchy

#define EEPROM             1            // EEPROM code enabled.
#define AT24C1024          1            // Atmel 24C1024 (20000 bytes, I2C)
//#define M93C76C            1            // Microchip 93C76C (1000 bytes, 3wr)
#define FLASH              0            // More flash routines.
#define I2C_INT            0            // H/W interface (interrupt driven).
#define I2C_POLLED         1            // H/W interface (polled).
#define I2C_FAST           0            // S/W interface (bit-banging of DIO pins).
#define UWR_FAST           0            // H/W microwire intfc (fast, polled).
#define UWR_SW             0            // S/W microwire intfc. (flexible)
#define MATH_FAST          0
#define SHUNTS             0
#define TIMERS             1            // Software timers exist.
#define TMR0               1            // H/W timer 0, used by timers.
#define TMR1               0            // H/W timer 1, now unused.
#define HARD_RESET_USABLE  0            // DIO_8 is wired to RESET
#define EXTRAS             0            // assorted unused code

// define low power modes
#define AUTOSLEEP          1            // !power->sleep;PB->LCD;reset->run
#define BROWNOUT_BATMODE   1            // enable code for this mode
#define LCD_BATMODE        1            // enable code for LCD mode
#define SLEEP_BATMODE      1            // enable code for this mode
#define BATTERY_TEST       1            // enable code to test battery
#define BATTERY			   0			// can run off battery.

// Define debug characteristics.
#define HEART_BEAT         1            // "It's alive!" indicator on LCD.
#define CONSTANTS_DBG      0            // Give ICE visibility of CE constants.
#define ENERGY_DBG         0            // Give ICE visibility to Energy structures.
#define IO_DEBUG           0            // Give ICE visibility of IO in xdata RAM
#define EEPROM_DBG         0    
#define DEBUG_TEST         0            // Use DIOs as test pins.

// Define characteristics of UART 0
#define BAUD_0 _RATE_9600  // 9600 baud.
#define SEVEN_BIT_0 0   // 8 bits
#define STOP_BIT2_0 0   // 1 stop bit
#define PARITY_ODD_0 0  // even
#define PARITY_NONE_0 1 // no parity

// Define characteristics of UART 1
#define BAUD_1 _RATE_9600    // 9600 baud.
#define SEVEN_BIT_1 0   // 8 bits
#define STOP_BIT2_1 0   // 1 stop bit
#define PARITY_ODD_1 0  // even
#define PARITY_NONE_1 1 // no parity

// serial protocols
#define SERIAL0            1              // UART 0 is a valid serial port
#define SERIAL1            1              // UART 1 is a valid serial port
#define CAL_LDR            1              // calibration loader, needs CAL_SAVE
#define FLAG               0              // FLAG interface exists...
#define FLAG0              0              // FLAG interface on uart 0
#define FLAG1              0              // FLAG interface on uart 1
#define CLI                1              // command line interface exists...
#define SERIAL0_CLI        1              // command line on serial port 0. 
#define SERIAL1_CLI        1              // command lines on serial port 1. 
#define SCROLL_METER       1              // Scroll meter if button pressed.
#define CLI_EEPROM         1    
#define HELP               0              // CLI help. Takes a lot of code space.
#define CE_OFF             0              // LCD "CE OFF".
#define PROFILE            0              // CLI "Profile Command" (big).    
#define LOAD               0              // CLI "Download Command" (big).   

// linkage from interrupt in serX.c to the higher-level serial code
#if SERIAL0_CLI
extern void cli0_out (void) small reentrant;
extern void cli0_in (void) small reentrant;
#define SER0_XMIT_INT cli0_out
#define SER0_RCV_INT cli0_in
#endif
#if SERIAL1_CLI
extern void cli1_out (void) small reentrant;
extern void cli1_in (void) small reentrant;
#define SER1_XMIT_INT cli1_out
#define SER1_RCV_INT cli1_in
#endif

// Choices of non-volatile memory.
// nonvolatile RAM has the least code, and unlimited writes, but needs an
// expensive battery with limited life.  Some meters need batteries anyway.
// Nonvolatile RAM is only available in a 651X device, and needs battery power
#define NV_XRAM            0
// FLASH needs a moderate amount of code, and is cheapest, writes are limited
// NV_FLASH requires that FLASH == 1 to include flash code
#define NV_FLASH           1
// EEPROM uses the most code, but is long-lived and moderately inexpensive
// NV_EEPROM requires that EEPROM == 1 to include EEPROM code
#define NV_EEPROM          2
                                        
#define NV_SELECT       NV_EEPROM   /* Selected non-volatile memory */

#define EMULATOR           1        /* 0 = disable emulator clock */
#define ROM                0
#define SOFTWARE_TRACE     0        // Enable trace sentinel routines.
#if SOFTWARE_TRACE
#include "trace.h"                  // enable trace sentinel routines
#endif

#define DEBUG_CMD          0        // enable flash programmer debug commmands

#include "options_gbl.h"            // global options, shared by builds

#endif // OPTIONS_h
/***************************************************************************
 * History:
 * $Log: options.h,v $
 * Revision 1.55  2006/10/13 00:49:41  tvander
 * Removed compile options for 6530, 6515;
 * renamed 6511 and 6513 to trace11 and trace13;
 * Binaries for all three equations verified unchanged from previous version.
 *
 * Revision 1.54  2006/10/06 01:54:06  tvander
 * Up to date.
 *
 * Revision 1.53  2006/10/06 01:47:51  tvander
 * Dual element equations (i.e. 2) have sums.  The other equations (i.e. 0 and 1)
 * pick the greater of the two phases as an anti-tampering defense.
 *
 * Revision 1.52  2006/10/03 00:32:24  tvander
 * Turned off WATT_SUMS and VAR_SUMS, so that maximum of elements is calculated instead of sums.
 *
 * Revision 1.51  2006/09/27 01:31:08  tvander
 * *** empty log message ***
 *
 * Revision 1.50  2006/09/14 00:37:22  tvander
 * Spaces for tabs
 *
 * Revision 1.49  2006/09/13 21:38:24  gmikef
 * *** empty log message ***
 *
 * Revision 1.48  2006/09/12 02:44:37  gmikef
 * *** empty log message ***
 *
 * Revision 1.47  2006/09/09 01:11:51  gmikef
 * *** empty log message ***
 *
 * Revision 1.46  2006/08/30 02:09:37  gmikef
 * *** empty log message ***
 *
 * Revision 1.45  2006/08/18 00:33:52  tvander
 * Made the definition of the equation a default, so it can be specified in the build.
 *
 * Revision 1.44  2006/08/08 00:46:25  tvander
 * Fixed build.
 *
 * Revision 1.43  2006/07/13 17:34:52  tvander
 * Watchdog hierarchy disabled; watchdog is reset every 1 second, no matter what.
 *

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -