CHAPTER 5
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 Bancomm, 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 O x Y Y Y Y S S S S
The following definitions pertain to FIFO data transfer.
#define SOH
#define ETB
#define FIFO
Ox01
Oxl 7
(short*)(BASE+0x2 7)
The following global variables are also declared and used throughout this chapter.
short dummy, *readptr, time [V ;
long i ;
5.1 READING TIME ON DEMAND
The following example reads the time from the TFP registers
TIMEO thru TIME4
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).
readptr = (short*)(BASE + Ox0A) ;
dummy = *+ ;
for(i=0 ; i<5 ; i++) time[i] = *+ ;
5.2 EXTERNAL EVENT TIME CAPTURE
/* initialize pointer */
/* latch time increment pointer */
/* read the time registers */
This example sets up the TFP event capture to occur on a rising edge and generate an interrupt. The
time capture lockout mechanism is also used.
#define EVENTO
#define CMD
#define VECTOR
#define MASK
#define INTSTAT
#define LEVEL
#define UNLOCK
(short*)(BASE+ Oxl 6)
(short *)(BASE -F Ox2 4)
(short *) (BASE+ Ox2C)
(short*)(BASE+0x28)
(short *)(BASE+ Ox2A)
(short *)(BASE+0X2E)
(short *) (BAS E + Ox2 0)
Datum Inc., Bancomm Div.
bc635VME/bc350VXI Manual
5
-
1