📄 rtctempcompensation.c
字号:
/*
* Project MSP430 RTC Temperature Compensation
*
* Software Name FLASH-resident Main Application Software
*
* Software Part Number tbd
*
* Module Filename RtcTempCompensation.c
*
* Module Description RTC Temperature Compensation Source File
*
* Module Language ANSI C
*
* Start Date 13/10/2004 WH Molesworth Initialed:
*
* Check Date --/--/---- - Initialed:
*
* Last Code Mod. Date 09/10/2006 WH Molesworth Initialed:
*
* Revision Status Version 1.00 (See Revision History below)
*
* Manufacturer: TI (Retro Watch Development Kit)
* <www.ti.com>
*
* Author: Hugh Molesworth nzbackpackers@yahoo.com
* Tel. US +1 (619) 846-4216
*
* Source by Hugh Molesworth. All Rights Reserved. Provided for guidance,
* feel free to use provided this notice is included.
*
* Revision History:
* =================
*
* Evaluation Release for TI MSP430 Design Contest
* ===============================================
* HM 00.01 09/10/2006 - Initial Release
*/
#include <msp430x43x.h>
#include "RtcTempCompensation.h"
// External references from original TI MSP430 Retro Watch Demo code:
extern void getTemp(void); // Gets the current temperature
extern short bcd_add_short(short arg1,short arg2);
extern signed int tempF; // Temperature variable
extern unsigned char seconds, minutes, hours; // The time values
#if defined (OPTION_USING_TEMPERATURE_COMPENSATION_FOR_RTC)
// The raw ADC Temperature value for the later compensation
uint16 SampledAdcRawValue = 0;
volatile byte UpdateTempCorrectionFlag = 0;
const byte FrequencyCorrectionTable[];
// Initialize RTC temperature cal index at (typically) 25 degrees C
uint16 RtcCorrectionTime;
//volatile byte RtcCorrectionIndex = CENTER_RTC_CALIBRATION_INDEX;
/*
* RTC Time Error Analysis
* =======================
* There are 4 primary sources of error in any crystal-derived RTC:
*
* 1. Initial frequency error, usually expressed in parts-per-million (ppm),
* typically +-20ppm (53 secs/month) or +-5ppm (13 secs/month). Cheaper
* crystals can be as much as +-100ppm (265 secs/month).
* 2. Load capacitance error (perhaps 10 secs/month), and delta load
* capacitance error, the latter capacitance change due to temperature,
* which is small enough to neglect.
* 3. Temperature-dependant error from the typically 25癈 nominal, usually
* expressed in ppm/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -