![Datum bc630AT User Manual Download Page 45](http://html.mh-extra.com/html/datum/bc630at/bc630at_user-manual_514078045.webp)
PROGRAMMING EXAMPLES
Datum Inc
bc630AT Real Time Clock Module
6-3
time[5] = ((inportb(BASE+2) & 0xF0) >> 4) | 0x30; /* Get hours tens and */
/* convert to BCD */
time[6] = (inportb(BASE+3) & 0xF) | 0x30;
/* Get days units and */
/* convert to BCD
*/time[7] = ((inportb(BASE+3) & 0xF0) >> 4) | 0x30;
/* Get days tens and */
/* convert to BCD */
time[8] = ((inportb(BASE+4) & 0xC0) >> 6) | 0x30); /* Get days hundreds and */
/* shift and convert to */
/* BCD */
/* Major BCD time now in */
/* time[] */
/* Get sub second */
/* time */
sub_seconds = (inportb(base+DAT04) & 0x1F) * 0x10000L;
/* Get sub second */
/* time bits 16-20 */
sub_s= inportb(base+DAT05); /* Get & sum sub */
/* second time bits*/
/* 0-7
*/
sub_s= inportb(base+DAT06) * 0x100L; /* Get & sum sub */
/* second time bits*/
/* 8-15 */
sub_seconds = (sub_seconds / (2E6+freq_error)) * 1E6; /* Compute real */
/*
:
secs with */
/* offset */
/* Sub second time */
/* now in */
/* sub_seconds */
6.3 SETTING THE REAL TIME CLOCK CHIP
The following example shows how to set the time of the independent, battery backed Real Time Clock
Chip.
/* Set time in RTC
chip
to 01/22/91, */
/* Tuesday, 13:23:45 */
outportb(BASE+0, 0x45); /* Load seconds data into Data */
/* Transfer Address Space */
outportb(BASE+1, 0x23); /* Load minutes data into Data */
/* Transfer Address Space */
outportb(BASE+2, 0x13);
/* Load hours data into Data */
/* Transfer Address Space */
outportb(BASE+3, 0x22); /* Load days data into Data Transfer */
/* Address Space */
outportb(BASE+4, 0x01);
/* Load months data into Data */
/* Transfer Address Space */
outportb(BASE+5, 0x91); /* Load year data into Data Transfer */
/* Address Space */
outportb(BASE+6, 0x02); /* Load day of week data into Data */
/* Transfer Address Space */
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com
Summary of Contents for bc630AT
Page 49: ...Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com ...
Page 50: ...Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com ...
Page 51: ...Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com ...
Page 52: ...Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com ...
Page 53: ...Artisan Technology Group Quality Instrumentation Guaranteed 888 88 SOURCE www artisantg com ...