HP (Hewlett-Packard) B Network Router User Manual


 
/* ********************* ReadData ********************* */
int ReadData(E1429 *Dig) {
int SegCnt, ReadCnt;
WORD *Readings, *Reading, *Reading2;
const static NReadings = 20, NSegments = 2;
const static float Scale = 0.0025 / 16.0;
Reading = Readings = (WORD *)
malloc(NSegments * NReadings * sizeof(WORD));
for (SegCnt = 0; SegCnt < NSegments; SegCnt++) {
while ((Dig->bGet(67) & 2) == 0);
Dig->MGetDataReg((UWORD *) Reading,NReadings);
Reading += NReadings;
}
printf(" **** Channel 1 ****\n");
printf(" Seg 1 Seg 2\n");
printf(" ---------- ----------\n");
Reading = Readings;
Reading2 = Readings + NReadings;
for (ReadCnt = 1; ReadCnt <= NReadings; ReadCnt++)
printf("%2d%+10.4f%+10.4f\n",ReadCnt,Scale
*
*Reading++,Scale
*
*Reading2++);
printf("\n");
free(Readings);
return 0;
}
SEGTST32.CPP This program transfers 32-bit readings (real time) from the channel 2 and
channel 1 A/D converters to the VME bus. In a 32-bit transfer, the upper
16-bits are the reading from channel 2 and the lower 16-bits are the reading
from channel 1 (Figure 3-11).
The include files and structure definitions used in this this program are
listed following the program listing.
74 Usin
g
the Di
g
itizer Chapter 2