#include #include #include #include "..\..\lib\7188.h" /* ------------------------------------------------------------------- */ WriteRTC(int addr,int data); void main() { int i,j,t,t1,t10; char c; int date,month,day,year; int sec,min,hour,ampm; #ifdef __TURBOC__ struct date _date; struct time _time; #else struct dosdate_t _dos_date; struct dostime_t _dos_time; #endif InitLib(); /* driver initial */ Init5DigitLed(); /* 5-digit LED initial */ WriteRTC(0,0); /* start RTC */ i=0; j=0; for (;;) { i++; i=i&0x01; if (i==0) { LedOn(); j++; j=j&0x07; for (t=1; t<=5; t++) Show5DigitLed(t,j); } else { LedOff(); for (t=1; t<=5; t++) Show5DigitLedSeg(t,0x80); } #ifdef __TURBOC__ getdate(&_date); gettime(&_time); sec=_time.ti_sec; min=_time.ti_min; hour=_time.ti_hour; date=_date.da_day; month=_date.da_mon; year=_date.da_year; #else _dos_getdate(&_dos_date); _dos_gettime(&_dos_time); sec=_dos_time.second; min=_dos_time.minute; hour=_dos_time.hour; date=_dos_date.day; month=_dos_date.month; year=_dos_date.year; #endif printf("\n%02d-%02d-%4d ",month,date,year); printf("%2d:%02d:%02d",hour,min,sec); printf("\nsec=%d,min=%d,hour=%d",sec,min,hour); printf(" * date=%d,month=%d,year=%d",date,month,year); while (kbhit() != 0) /* check user keyboard */ { c=getch(); /* get user's key-in */ if ((c=='q')|| (c=='Q')) return; /* return to ROM-DOS */ printf("(%c)",c); } DelayMs(500); /* delay about 0.5 sec */ } }