![Datum bc630AT User Manual Download Page 43](http://html.mh-extra.com/html/datum/bc630at/bc630at_user-manual_514078043.webp)
Datum Inc
bc630AT Real Time Clock Module
6-1
CHAPTER SIX
PROGRAMMING EXAMPLES
6.0 GENERAL
This section provides programming examples to illustrate the operation of the bc630AT. The examples
are written in Turbo C. Hexadecimal constants are specified in C by using the prefix '0x'.
The BASE constant refers to the base address setting of SW1 (refer to Chapter Two). Memory
locations are referred to with the BASE constant plus an offset constant. The offset constants are
referred to with a label that is defined in Table 3-1 and Table 3-2.
6.1 SETTING UP THE CONTROL REGISTERS
This example shows how to program the bc630AT control registers. The bc630AT is setup to
automatically detect an IRIG A, IRIG B, NASA 36 or 2137 modulated or DC level shift time code
input signal, disable external event time capture, disable heartbeat pulses, disable the filter, disable
external flywheel synchronization and select no interrupt sources. The example manually sets up the
bc630AT to the default conditions.
/* Set up control registers
*/
outportb(BASE+TCSEL, 0);
/* Select automatic time code
*/
/* selection
*/
/* Initialization mode = normal
*/
outportb(BASE+MASKS, 0);
/* Disable event capture, disable */
/* filter, external flywheel
*/
/* disabled, disable heartbeats, no */
/* interrupts
*/
outportb(BASE+HBDIV0, 0xE8);
/* Set heartbeat pulse/interrupt */
outportb(BASE+HBDIV0, 0x03);
/* frequency 1000 Hertz
*/
outportb(BASE+PROPDEL0, 0); /* Set propagation delay to 0
*/
outportb(BASE+PROPDEL1, 0);
outportb(BASE+COMMAND, 0x90) /* Initialize bc630AT to above
*/
do
/* control settings
*/
{
time_delay();
/* User defined time delay function */
/* that slows polling rate of
*/
/* COMMAND byte to less than 500 KHz */
}
while (inportb(BASE+COMMAND) != 0x10); /* Wait for ready value of 0x10 from */
/* bc630AT, indicating 'Initialize' */
/* complete
*/
time_delay()
{
int i;
for (i=100; i != 0; i--);
/* Initial value for i is dependent */
}
/* on host PC's clock speed to slow */
/* polling rate to < 500 KHz
*/
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 ...