?? rtc.c
字號:
/*************************************Seekfor Embedded DOS v1.0***************************************************
****** *** ***** ****** **** ****** v1.0
** ** ** ** ** ** ** ** ** ** **
** ** ** ** ** ** ** ** ** **
** ** ** ** ** ** ** **
** ***** ***** ** **** ******* ***** ******** ***** ** ** ** ** **
*** ** ** ** ** ** ** ** ** ** *** ** ** ** ** ** ** ** ***
** ******* ******* **** ** ** ** ** ******* ** ** ** ** **
** ** ** ***** ** ** ** ** ** ** ** ** ** **
** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **
** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **
****** ***** ***** ******** ****** ***** ****** ***** ****** **** ******
<1)基本描述
Seekfor Embedded DOS v1.0是嵌入式的一個類DOS操作系統,支持FAT16/FAT32.
<2)文件描述
文件名:rtc.c
功能:real time counter功能
<3>如需更新版本軟件,請聯系:
QQ:82054357
Mail:Seek_for@163.com
MSN:sfrad32@hotmail.com
**************************************************************************************************************/
#ifndef __RTC_C__
#define __RTC_C__
#include "dos.h"
void RTC_getdate(date*ret)
{
ret->da_year=2000+rBCDYEAR;
ret->da_mon=(rBCDMON>>4)*10+(rBCDMON&0x0f);
ret->da_day=(rBCDDATE>>4)*10+(rBCDDATE&0x0f);
}
void RTC_gettime(time*ret)
{
ret->ti_hour=(rBCDHOUR>>4)*10+(rBCDHOUR&0x0f);
ret->ti_min=(rBCDMIN>>4)*10+(rBCDMIN&0x0f);
ret->ti_hund=0;
ret->ti_sec=(rBCDSEC>>4)*10+(rBCDSEC&0x0f);
}
void RTC_setdate(date*ret)
{
rBCDYEAR=ret->da_year-2000;
rBCDMON=((ret->da_mon/10)<<4)+(ret->da_mon%10);
rBCDDATE=((ret->da_day/10)<<4)+(ret->da_day%10);
}
void RTC_settime(time*ret)
{
rBCDHOUR=((ret->ti_hour/10)<<4)+(ret->ti_hour%10);
rBCDMIN=((ret->ti_min/10)<<4)+(ret->ti_min%10);
rBCDSEC=((ret->ti_sec/10)<<4)+(ret->ti_sec%10);
}
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -