📄 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 + -