00001 /************************************************************************************************** 00002 Title : PIC24F Series Virtual Real Time Clock Driver 00003 Programmer : Yosuke FURUSAWA 00004 Copyright : Copyright (C) 2008-2010 Yosuke FURUSAWA. 00005 License : 4-clause BSD License 00006 Since : 2008/11/12 00007 00008 Filename : librtc.h 00009 Last up date : 2010/08/13 00010 Kanji-Code : Shift-JIS 00011 TAB Space : 4 00012 **************************************************************************************************/ 00013 00014 00015 #ifndef _LIBRTC_H_ 00016 #define _LIBRTC_H_ 00017 00018 00019 /*================================================================================================= 00020 マクロ定義 00021 =================================================================================================*/ 00022 #define RTC_LOWMEM 00023 00024 00025 /*================================================================================================ 00026 構造体 00027 =================================================================================================*/ 00028 typedef struct RTC { 00029 unsigned int msec; /* ミリ秒 */ 00030 unsigned char sec; /* 秒 */ 00031 unsigned char min; /* 分 */ 00032 unsigned char hour; /* 時 */ 00033 unsigned int day; /* 日 */ 00034 00035 unsigned int tick; /* 起動後の合計時間(ミリ秒) */ 00036 00037 #ifndef RTC_LOWMEM 00038 unsigned int secmeter; /* 起動後の合計時間(秒) */ 00039 unsigned int minmeter; /* 起動後の合計時間(分) */ 00040 unsigned int hourmeter; /* 起動後の合計時間(時) */ 00041 #endif 00042 00043 } RTC_T; 00044 typedef RTC_T* pRTC_T; 00045 00046 00047 /*================================================================================================= 00048 グローバル変数 00049 =================================================================================================*/ 00050 extern RTC_T rtc; 00051 00052 00053 /*================================================================================================ 00054 プロトタイプ宣言 00055 =================================================================================================*/ 00056 extern void RTC_init(void); 00057 extern void RTC_init_timer(void); 00058 extern unsigned int RTC_get_ticks(unsigned int start, unsigned int end); 00059 00060 00061 #endif