PT630 Programming Reference Guide
Page 37 of 59
------------------------------------------------------------------------------------------------------------------
1.5.21 Get System Time
Entry Parameter: AH = 2CH
Return Value: CH = hour (0 - 23)
CL = minute (0 - 59)
DH = second (0 - 59)
Example
:
void TS_get_time(int *hour,int *minute,int *second,int *mini_sec)
{
TD_int_dos1(0x2c,0,0,0);
*hour = (int)regs.h.ch;
*minute = (int)regs.h.cl;
*second = (int)regs.h.dh;
*mini_sec = (int)regs.h.dl;
}
1.5.22 Set System Time
Entry Parameter: AH = 2DH
CH = hour (0 - 23)
CL = minute (0 - 59)
DH = second (0 - 59)
Return Value: AL = 0/FFH
; OK/Setting error
Example
:
int TS_set_time(int hour,int minute,int second)
{
regs.h.ah = 0x2d;
regs.h.ch = hour;
regs.h.cl = minute;
regs.h.dh = second;
int86(0x21,®s,®s);
return((int)regs.h.al);
}
1.5.23 Set Alarm Date
Entry Parameter: AH = 2EH
AL
=
0
;
disable
alarm
; enable alarm everyday
; enable alarm by date
If
AL
=
2:
CX = year (1980 - 2079)
DH = month (1 - 12)
DL = day (1 - 31)
Return Value: AL = 0/FFH
; OK/Setting error
Example
:
int TS_alarm_date(int status,int year,int month,int day)
{
regs.h.ah = 0x2E;
regs.h.al = (unsigned char)status;
regs.x.cx = year;
regs.h.dh = (unsigned char)month;
regs.h.dl = (unsigned char)day;
int86(0x21,®s,®s);
return((int)regs.h.al);
}