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

📄 ce652x.c

📁 TDK 6521 SOC 芯片 DEMO程序
💻 C
字号:
/***************************************************************************
 * 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 - Compute Engine Program/Data.
// 
//  AUTHOR:  MTF
//
//  HISTORY: 2005 March 14; First Version. 
//**************************************************************************
// File: CE652x.C
//               
#include "options.h"
//volatile int32x_t vbat       _at_ (CE_DATA_BASE + (0x07 << 2));
volatile int32x_t cal_i0     _at_ (CE_DATA_BASE + (0x08 << 2));
volatile int32x_t cal_v0     _at_ (CE_DATA_BASE + (0x09 << 2));
volatile int32x_t cal_i1     _at_ (CE_DATA_BASE + (0x0A << 2));
volatile int32x_t cal_v1     _at_ (CE_DATA_BASE + (0x0B << 2));
volatile int32x_t phadj_0    _at_ (CE_DATA_BASE + (0x0C << 2));
volatile int32x_t phadj_1    _at_ (CE_DATA_BASE + (0x0D << 2));

volatile int32x_t apulsew    _at_ (CE_DATA_BASE + (0x0E << 2));
volatile int32x_t apulser    _at_ (CE_DATA_BASE + (0x0F << 2));
volatile int32x_t cestate	 _at_ (CE_DATA_BASE + (0x10 << 2));
volatile int32x_t wrate      _at_ (CE_DATA_BASE + (0x11 << 2));
volatile int32x_t gain_adj   _at_ (CE_DATA_BASE + (0x12 << 2));
volatile int32x_t quant      _at_ (CE_DATA_BASE + (0x13 << 2));
volatile int32x_t sagthr     _at_ (CE_DATA_BASE + (0x14 << 2));
volatile int32x_t quant_var  _at_ (CE_DATA_BASE + (0x15 << 2));
volatile int32x_t quant_i    _at_ (CE_DATA_BASE + (0x16 << 2));
volatile int32x_t kvar       _at_ (CE_DATA_BASE + (0x17 << 2));
volatile int32x_t wsum_accum _at_ (CE_DATA_BASE + (0x7D << 2));
volatile int32x_t vsum_accum _at_ (CE_DATA_BASE + (0x7E << 2));
volatile int32x_t vbat       _at_ (CE_DATA_BASE + (0x7F << 2));

// Outputs from CE.
volatile struct Outputs_t xdata CE_Outputs _at_ (CE_DATA_BASE + (0x71 << 2)); 

#if ENERGY_DBG 				   			// Outputs from CE copy.
volatile struct Outputs_t pdata    Outputs _at_ (0x0750);       
#endif
#if IMAX2
volatile int32_t pdata var1sum_ce    _at_ (0x0750);  // Outputs from CE.
volatile int32_t pdata w1sum_ce      _at_ (0x0754);   
volatile int32_t pdata i1sqsum_ce    _at_ (0x0758);   
#else
volatile int32_t pdata var1sum       _at_ (0x0750);  // Outputs from CE.
volatile int32_t pdata w1sum         _at_ (0x0754);   
volatile int32_t pdata i1sqsum       _at_ (0x0758);   
#endif
volatile int32_t pdata v1sqsum       _at_ (0x075C);   

volatile int32_t pdata var0sum       _at_ (0x0760);   
volatile int32_t pdata w0sum         _at_ (0x0764);   
volatile int32_t pdata i0sqsum       _at_ (0x0768);   
volatile int32_t pdata v0sqsum       _at_ (0x076C);   

volatile int32_t pdata freq          _at_ (0x0770);   
volatile int32_t pdata cestatus      _at_ (0x0774);   
volatile int32_t pdata temp_raw      _at_ (0x0778);
volatile int32_t pdata main_edge_cnt _at_ (0x077C);   
#if PHASE_C_PRESENT
volatile int32_t pdata w2sum         _at_ (0x0780);  // Sum of output samples from wattmeter element 2.
volatile int32_t pdata var2sum       _at_ (0x0784);  // Sum of output samples from var meter element 2.
volatile int32_t pdata insqsum       _at_ (0x0788);  // Sum of IN^2 samples. 
volatile int32_t pdata i2sqsum       _at_ (0x078C);  // Sum of I2^2 samples. 
volatile int32_t pdata v2sqsum       _at_ (0x0790);  // Sum of V2^2 samples.

volatile int32_t pdata PH_AtoB       _at_ (0x0794); 
volatile int32_t pdata PH_AtoC       _at_ (0x0798);  // PH_AtoC_X * 360 / SUMPRE + 4.8 [0, 360] (degrees). 
#endif // phase C present
/***************************************************************************
 * History:
 * $Log: ce652x.c,v $
 * Revision 1.25  2006/09/09 01:13:16  gmikef
 * *** empty log message ***
 *
 * Revision 1.24  2006/06/14 02:44:05  tvander
 * Makes the vbat from the CE available.
 *
 * Revision 1.23  2006/05/18 23:18:51  tvander
 * 16K and 32K
 * First cut at new requirements.
 * 32K 6521 is grossly tested.
 * All others have a clean compile with C51 8.02
 *
 * Revision 1.22  2006/04/25 01:09:54  tvander
 * Integrated improved RTC.  Compensates for time off, has default constant
 * compensation.  Computes true hours of operation.
 *
 * Revision 1.21  2006/03/17 00:28:35  tvander
 * Added IMAX2
 *
 * Revision 1.20  2006/03/06 03:37:34  Michael T. Fischer
 * More 6530 prep.
 *
 * Revision 1.19  2006/01/25 01:04:45  tvander
 * Added DEG_SCALE
 *
 * Revision 1.18  2006/01/20 21:28:02  gmikef
 * Moved "CE_Constants" to "ce.c" to get around linker bug.
 *
 * Revision 1.17  2006/01/10 04:05:46  gmikef
 * Added PDATA support for CE Outputs.
 *
 * Revision 1.16  2005/12/23 01:27:45  tvander
 * Meter.c would not compile for 6513 because a table was wrong.
 * A few style issues.
 *
 * Revision 1.14  2005/09/22 23:45:15  tvander
 * Clean build all models and unit tests, updated copyright to be fore Teridian
 *
 * Revision 1.13  2005/08/30 18:15:37  gmikef
 * *** empty log message ***
 *
 * Revision 1.12  2005/08/18 20:44:44  tvander
 * Added temperature measurement to GUI-available fields.
 * FIxed memory-space problem in add8_8
 * Added temp_x, temp_nom, ppmc and ppmc2 to register def. file.,
 * moved many other registers, whcih where in the way.
 *
 * Revision 1.11  2005/08/12 06:01:22  gmikef
 * Added MPU temperature compensation for GAIN_ADJ.
 * Added changes to support new CE 6521 code.
 *
 * Revision 1.10  2005/08/10 02:01:42  gmikef
 * *** empty log message ***
 *
 * Revision 1.9  2005/07/14 20:15:51  tvander
 * ce code concentrated in ce.c
 * ce interface concentrated in ce652x.c, .h
 * Fixed 0-length read or write using flag protocol.
 * display.c is out of the build
 * kwh_initialize now reads the LRC.
 *
 * Revision 1.8  2005/06/09 00:01:23  tvander
 * Flag reads and writes work for power registers, the real time clock and CE RAM.
 *
 * Revision 1.7  2005/05/26 21:54:38  tvander
 * Flag is grossly working with GUI: signs on, reads, writes both xdata and idata, interlocks with CE cycle, and timeouts work.
 *
 * Revision 1.6  2005/05/19 00:50:47  tvander
 * read_trim () included with firmware.
 *
 * Revision 1.5  2005/05/06 16:40:34  tvander
 * Build errors fixed
 *
 * Revision 1.4  2005/05/03 19:13:14  tvander
 * Moved gain_adj to 22, moved up the intermediate variables.
 *
 * Revision 1.3  2005/04/30 02:13:30  gmikef
 * *** empty log message ***
 *
 *
 * Revision 1.2  2005/04/27 23:41:36  gmikef
 * Some MATH rountines now use 'idata'.
 * Added MATH_FAST flag to 'options.h".
 * Changed "6521B.Uv2" to max optimization.
 *
 * Copyright (C) 2005 Teridian Semiconductor Corp. All Rights Reserved.    *
 * this program is fully protected by the United States copyright          *
 * laws and is the property of Teridian Semiconductor Corporation.         *
 ***************************************************************************/

⌨️ 快捷键说明

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