Symmetricom, Inc.
bc620/627AT Time and Frequency Processor
5-1
CHAPTER FIVE
PROGRAMMING EXAMPLES
5.0 GENERAL
The example code fragments in this chapter are written in the “C” programming language. A
system dependent base address (BASE) indicates a 16 byte page of memory used in the PC AT
I/O address space as selected by the SW1 switch settings (SSS).
#define BASE
0xSSS
The following definitions pertain to FIFO data transfer:
#define SOH
0x01
#define ETB
0x17
The following general definitions also apply :
#define ACK
(BASE+0x0B)
#define CRO
(BASE+0x00)
#define EVENT0
(BASE+0x01)
#define INTSTAT
(BASE+0x0D)
#define FIFO
(BASE+0x0E)
#define PAGE
(BASE+0x0F)
#define TIME0
(BASE+0x01)
Th
e following global variables are also declared and used throughout this chapter.
char
i, dummy, time[9];
5.1 READING TIME ON DEMAND
The following example reads the time from the TFP registers TIME0 thru TIME7 and loads this
data into the array time[ ]. Note that the time is latched by reading the TIMEREQ register, and
that the register is assigned to a global variable. In most cases assignment to a global avoids the
possibility that the dummy read operation will be removed by an optimizing compiler (beware).
outportb(PAGE,0x00);
/* Access PAGE0 */
dummy = inportb(BASE+0x00);
/* latch time */
for(i=0;i<8;i++) time[i]=inportb(TIME0+i); /* read the time registers */
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com