📄 rtctempcompensation.h
字号:
/*
* Project MSP430 RTC Temperature Compensation
*
* Software Name FLASH-resident Main Application Software
*
* Software Part Number tbd
*
* Module Filename RtcTempCompensation.h
*
* Module Description RTC Temperature Compensation Header 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
*/
#ifndef RTC_COMPENSATION_H
#define RTC_COMPENSATION_H
#define OPTION_USING_TEMPERATURE_COMPENSATION_FOR_RTC
#define OPTION_USING_TIMERA_3_FOR_RTC
// The error correction of +3 is for about +12.5 seconds of error in 38hrs 17mins
// Error reduced to -1 second in 48 hours using 3, so use 2 + delta
// ie total unadjusted error approx 14.67 seconds per 48 hours -> 2.78187 -> 2 plus 47 counts/minute
#define TIMER_A_RESET_TIME (32767+2) // (32768-1) 1 second tick @ 32.768KHz plus error
#define TIMER_A_DELTA_TIME (47) // delta adjust every minute (add this to temp correction)
typedef unsigned char byte;
typedef unsigned short uint16;
typedef short sint16;
typedef unsigned long uint32;
typedef long sint32;
#if defined (OPTION_USING_TEMPERATURE_COMPENSATION_FOR_RTC)
#define MIN_RTC_CALIBRATION_TEMP (-40) // degrees C, lowest value
#define CENTER_RTC_CALIBRATION_TEMP ( 25) // degrees C, zero cal value
#define MAX_RTC_CALIBRATION_TEMP ( 90) // degrees C, maximum value
// zero cal index at (typically) 25 degrees C
#define CENTER_RTC_CALIBRATION_INDEX (CENTER_RTC_CALIBRATION_TEMP-MIN_RTC_CALIBRATION_TEMP)
// The raw ADC Temperature value for the later compensation
extern uint16 SampledAdcRawValue;
extern volatile byte UpdateTempCorrectionFlag;
extern const byte FrequencyCorrectionTable[];
// Initialize RTC temperature cal index at (typically) 25 degrees C
extern uint16 RtcCorrectionTime;
//volatile byte RtcCorrectionIndex = CENTER_RTC_CALIBRATION_INDEX;
void UpdateCorrection(void);
void InitialiseTimerA1(void);
#endif
#endif //#ifndef RTC_COMPENSATION_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -