Symmetricom Inc
bc635VME/350VXI Time and Frequency Processor (Rev. E)
5-1
CHAPTER FIVE
PROGRAMMING EXAMPLES
5.0 GENERAL
The example code fragments in this chapter are written in the C programming language. The
examples have been tested at Symmetricom, and should be transportable to most programming
environments. A system dependent base address is defined below where “YYYY” indicates a 64
kbyte page of memory used for A16 data and “SSSS” indicates the SW1 and SW2 switch
settings.
#define BASE
0xYYYYSSSS
The following definitions pertain to FIFO data transfer.
#define SOH
0x01
#define ETB
0x17
#define FIFO
(short*)(BASE+0x27)
The following global variables are also declared and used throughout this chapter.
short dummy, *readptr, time[5] ;
long
i ;
5.1 READING TIME ON DEMAND
The following example reads the time from the TFP registers TIME0 through TIME4 and loads
this data into the array time[ ]. The time is latched by reading the TIMEREQ register, and 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).
readptr = (short*)(BASE + 0x0A) ;
/* initialize pointer */
dummy = *+ ;
/* latch time increment pointer */
for(i=0 ; i<5 ; i++) time[i] = *+ ;
/* read the time registers */
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com