📄 defaults.c
字号:
#if FLAG1
ser1_initialize (baud); // initialize serial interface
flag1_initialize (); // initialize flag
#elif SERIAL1_CLI
#if !SERIAL0_CLI
port = 1; // force it if it's the only one
#endif
if(port == 1)
echo = defaults[ BAUD1_IDX+1 ] & ECHO;
cli1_init (baud, defaults[ BAUD1_IDX+1 ] & XON_XOFF);
#else
ser1_initialize (baud); // initialize serial interface
#endif
#endif
#if CLI
MPU_Clk_Select (port, CONFIG0 & MPU_DIV);
#endif
// reserved = defaults[ 5 ]; // Reserved.
// #if M6521A01
// DIO_8 = 0; // pulse DIO_8 low on reset
// DIR2 |= 1;
// #endif
USER2 = defaults[ 9 ]; // Setup output values of DIO pins.
USER1 = defaults[ 10 ];
USER0 = defaults[ 11 ];
DIR2 = defaults[ 6 ]; // Setup IO pins as inputs or outputs.
DIR1 = defaults[ 7 ];
DIR0 = defaults[ 8 ];
/* emulator interface set up; this is last in order to debug the set-up */
#if !EMULATOR
CONFIG1 |= ECK_DIS; // Disable the emulator clock.
#endif
}
/***************************************************************************
* $Log: defaults.c,v $
* Revision 1.86 2006/10/13 00:48:13 tvander
* Removed compile options for 6530, 6515;
* renamed 6511 and 6513 to trace11 and trace13;
* Binary verified unchanged from previous version.
*
* Revision 1.85 2006/03/10 00:05:06 tvander
* BAUD_IDX (baud index) for serial 0 and 1 are made public so that initializations
* can use the io_merge baud rates.
*
* Revision 1.84 2006/09/29 09:41:49 tvander
* Remove "battery bit"
*
* Revision 1.83 2006/09/29 08:52:49 tvander
* Fixed build error.
*
* Revision 1.82 2006/09/27 01:02:59 tvander
* 6520 has a "Battery mode jumper" on DIO_8, added comments.
* Changes baud rate depending on battery mode jumper.
*
* Revision 1.81 2006/09/18 19:27:43 tvander
* Starting LCD selection is 3, wh
*
* Revision 1.80 2006/09/12 02:44:16 gmikef
* *** empty log message ***
*
* Revision 1.79 2006/09/10 00:25:44 Michael T. Fischer
* First version to support DGM0915 LCD.
*
* Revision 1.78 2006/09/09 01:10:47 gmikef
* *** empty log message ***
*
* Revision 1.77 2006/09/06 21:24:52 tvander
* Version 4.3.3
*
* Revision 1.76 2006/09/06 02:15:58 tvander
* Added case to handle a 6520 without brownout mode.
*
* Revision 1.75 2006/08/30 02:09:19 gmikef
* *** empty log message ***
*
* Revision 1.74 2006/08/16 20:29:01 tvander
* Rolled rev from 4.3.1 to 4.3.2
*
* Revision 1.73 2006/08/08 21:57:06 tvander
* Changed version number to 4.3.1
*
* Revision 1.72 2006/07/31 18:04:30 tvander
* Enabled XON/XOFF so CLC and long scripts both work in a CLI system.
*
* Revision 1.71 2006/07/28 02:45:40 tvander
* Rolled rev no.
*
* Revision 1.70 2006/07/17 20:48:04 tvander
* Removed redundancies, made temp_nom values more realistic
*
* Revision 1.69 2006/07/10 23:22:39 tvander
* Include 1.28mHz clock rate.
*
* Revision 1.68 2006/07/07 01:11:34 tvander
* 6520's EEPROM bits start as "inputs" to reduce current usage.
* Padded ri_Defaults so its the same length in all versions, for IO_MERGE
*
* Revision 1.67 2006/06/24 04:43:23 tvander
* Debugged the battery modes, especially the mission->brownout transition
* Includes necessary changes for the reset hack needed for the 6521A03.
*
* Revision 1.66 2006/06/22 22:43:20 tvander
* Initialized DIO_8 on 6521A03 to have an output value of 0, so it doesn't reset.
*
* Revision 1.65 2006/06/20 20:37:17 tvander
* Removed logic to read a LCD pin to trigger autocal (it now uses the button).
* Added logic to support 614kHz operation.
*
* Revision 1.64 2006/06/14 02:59:05 tvander
* Simplifiedthe brownout, regressing to 17april06 version, but with hang
* removed, and a brownout display that always executes before entering sleep mode.
*
* Reduced the MPU clock 8x from 4.9mHz to 614kHz
*
* Revision 1.63 2006/06/09 00:21:00 tvander
* Tested defaults.
*
* Revision 1.62 2006/06/06 05:17:02 tvander
* clean build
*
* Revision 1.61 2006/06/06 04:15:35 tvander
* Corrected defaults for max. current and voltage.
* New scheme for calibration flags.
*
* Revision 1.60 2006/05/25 03:27:21 tvander
* Enables DIO2 as a pulse output.
*
* Revision 1.59 2006/05/18 23:18:46 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.58 2006/04/28 22:25:10 tvander
* Reverse ported defects found when the serial code was ported to 3.05
* Also made scrolling the default. It's ugly, though.
*
* Revision 1.57 2006/04/17 19:17:05 tvander
* Arranged for 6520 firmware to start with the pulse lights off.
*
* Revision 1.56 2006/04/12 00:32:51 tvander
* Corrected 6513's pulse selections
*
* Revision 1.55 2006/03/17 00:23:19 tvander
* Reformatted Parameter_T
*
* Revision 1.54 2006/03/08 03:07:12 gmikef
* *** empty log message ***
*
* Revision 1.53 2006/03/08 00:02:47 tvander
* Disabled oscope.
* Made date automatically the date of compilation.
* Clean build, tested dates.
*
* Revision 1.52 2006/03/06 03:33:17 Michael T. Fischer
* More prep.
*
* Revision 1.51 2006/03/03 11:26:50 Michael T. Fischer
* Prep for LCD, etc.
*
* Revision 1.50 2006/02/18 01:27:56 tvander
* Rolled date. Clean build
*
* Revision 1.49 2006/02/11 02:09:24 tvander
* Clean build:
* Fixed up 6513.uv2
* Deleted landis & gyr build because it's proprietary.
*
* Revision 1.48 2006/02/10 00:50:16 tvander
* Rolled date
*
* Revision 1.47 2006/02/08 03:43:19 tvander
* Made "import" the default power measurement mode, rather than net-metering
*
* Revision 1.46 2006/01/25 02:02:47 tvander
* Preliminary release
*
* Revision 1.45 2006/01/16 20:11:25 tvander
* Clean Keil build, all versions
*
* Revision 1.43 2005/12/21 01:29:22 tvander
* 6513
*
* Revision 1.42 2005/12/13 17:31:55 tvander
* Reelased to W. Homma for SUG
*
* Revision 1.41 2005/12/09 19:37:05 tvander
* Rolled date
*
* Revision 1.40 2005/12/07 01:42:33 tvander
* Rolled date
*
* Revision 1.39 2005/11/29 01:18:58 tvander
* Automatic software watchdog
*
* Revision 1.38 2005/11/10 22:51:32 tvander
* 6520 has battery mode commands.
* Brownout always has decimal point 7.
* LCD Mode always has decimal points 7 and 6.
* Sag detection is disabled.
*
* Revision 1.37 2005/11/09 02:21:16 tvander
* Added code to display watt hours from brownout mode.
* Added code to clear EEPROM (lapie command "EEE")
*
* Revision 1.36 2005/11/05 01:57:24 tvander
* Added code to clear pushbutton and wake flags.
*
* Revision 1.35 2005/11/03 19:20:53 tvander
* Fixed initialization of PLL_FALLING interrupt.
* Rolled date.
*
* Revision 1.34 2005/10/31 21:59:59 tvander
* Display initialization is not part of the CLI version- it must be present in all versions.
*
* Revision 1.33 2005/10/31 17:38:00 tvander
* Includes improved EEPROM code with uwire.
* Clean build, all build trees (Thank-you, Mike!)
*
* Revision 1.32 2005/10/20 18:39:41 tvander
* Ported 2-wire EEPROM code from 6511/6513, including interrupting version, polling version for DIO, and polling version using the 2-wire logic.
*
* Revision 1.31 2005/10/18 02:17:09 tvander
* Access CLI in brownout by pressing reset.
* Debugged serial 1 usage from CLI.
* Implemented scrolling display as M17
*
* Revision 1.30 2005/10/12 23:00:03 tvander
* Includes demonstratable mission mode, brownout, LCD and sleep modes
*
* Revision 1.29 2005/10/08 04:41:21 tvander
* Fixed priority inversion.
* Rewrote watchdog to work in brownout, but of course it doesn't work.
* Watchdog can now be defeated by clearing watchdog option to 0.
* Reorganized watt hour modules (at last!).
* Disabled reading of STATUS in 6521_cli because the CE's status is always SAG.
* Tested with 6521_CLI; measurements seem to work.
* Fixed other builds.
*
* Revision 1.28 2005/10/06 20:55:01 tvander
* Preliminary logic to manage the battery modes.
*
* Revision 1.27 2005/09/28 20:54:02 tvander
* V/I phase displays for all phases,
* main edge count displays for both types,
* rewrote setup from defaults to group related functions.
*
* Revision 1.26 2005/09/28 01:02:22 tvander
* Rolled date
*
* Revision 1.25 2005/09/22 23:45:09 tvander
* Clean build all models and unit tests, updated copyright to be fore Teridian
*
* Revision 1.24 2005/09/13 19:26:54 tvander
* Release 6521 CLI version for early customers.
* RMS works.
* Accumulation interval to 1 second.
* Wrate slowed to 3.2 Kh/pulse for new accumulation interval.
* Pulse outputs inverted, so they start dark.
* LCD density increased from 1/3 bias to 1/2 bias, for demo PCB.
* VAh code is included, but untested.
*
* Revision 1.23 2005/09/12 07:47:29 tvander
* Power measurement is stable, with no creep.
* VARh measurement is stable, with no creep.
* Pulse sources work.
* Full access to MPU variables.
* Rolled date.
* Clock software works.
*
* Revision 1.22 2005/09/11 00:34:01 tvander
* Clean compiles
*
* Revision 1.21 2005/09/08 00:31:41 tvander
* Fixed: Lost data due to overwrite of Ithrshld, xfer busy never runs,
* unavailable second phase, cosmetic issues with status. Updated
* date.
*
* Revision 1.20 2005/09/03 02:17:55 tvander
* Added defaults to show sums when sums are enabled,
* Conductor 1 when they aren't.
*
* Revision 1.19 2005/09/02 01:49:41 gmikef
* Fixed CLI RTR command.
*
* Revision 1.18 2005/09/01 04:22:37 gmikef
* *** empty log message ***
*
* Revision 1.17 2005/09/01 02:04:10 gmikef
* Cleaned up the builds.
*
* Revision 1.16 2005/08/31 22:36:21 tvander
* Updated for 6521B
*
* Revision 1.15 2005/08/31 05:55:17 gmikef
* First version w/ LAPIE interface.
*
* Revision 1.14 2005/08/30 18:13:01 gmikef
* *** empty log message ***
*
* Revision 1.13 2005/08/28 02:18:16 gmikef
* *** empty log message ***
*
* Revision 1.12 2005/08/22 22:30:55 tvander
* Clean build of FLAG system
* No pulse counting.
* No debug/CLI.
*
* Revision 1.11 2005/08/19 01:04:41 gmikef
* *** empty log message ***
*
* Revision 1.10 2005/08/18 17:38:53 gmikef
* *** empty log message ***
*
* Revision 1.9 2005/08/18 16:54:36 gmikef
* *** empty log message ***
*
* Revision 1.8 2005/08/17 04:03:59 gmikef
* *** empty log message ***
*
* Revision 1.7 2005/08/16 02:28:30 gmikef
* Remapped LCD for 6520 Eval Board.
* Mapped CE code location to address of 'CeCode'.
*
* Revision 1.6 2005/08/10 01:58:55 gmikef
* *** empty log message ***
*
* Revision 1.5 2005/07/14 20:15:49 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.4 2005/07/01 00:26:33 tvander
* Made the voltage comparison and creep parameters real.
* Broke out the configurations by chip, so 6513 is different from
* the 6511 and 6521, because the current and voltage limits have different LSBs.
*
* Revision 1.3 2005/06/03 00:33:33 tvander
* Added imports to 6511.
* Added register definition spreadsheet to .doc
*
* Revision 1.2 2005/05/21 01:48:25 gmikef
* *** empty log message ***
*
* Revision 1.1 2005/05/20 01:18:10 gmikef
* Switched to comon Main, Defaults & Display code for all parts.
*
* Revision 1.4 2005/05/14 00:56:19 tvander
* Integrated flag0, ser0
* Regression tested and fixed 6521b
*
* Revision 1.3 2005/05/13 00:34:42 tvander
* 6511/32k works
* Integrated and debugged self-calibration.
* The build has one unused segment, and no other errors or warnings.
* default LCD and pulse displays appear OK.
* EEPROM, software timers and hardware timers are all integrated.
*
* Revision 1.2 2005/05/06 16:40:31 tvander
* Build errors fixed
*
* Revision 1.1 2005/04/28 19:20:07 tvander
* Improved; almost compiles
*
* Revision 1.1 2005/04/21 02:04:12 gmikef
* *** empty log message ***
*
* 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. *
***************************************************************************/
/* defaults.c */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -