/* convert and display the readings; readings are in the sequence */ /* channel 2 reading 1, channel 1 reading 1, channel 2 reading 2, */ /* channel 1 reading 2, and so on */

for (i = 0; i < readings; i++)

{

rdgs[i] /= 16;

if (rdgs[i] >= 2047 rdgs[i] <= -2046) printf("\nReading overrange");

else

printf("\nReading %d = %.6E", i, (rdgs[i] * 0.0025));

}

free(rdgs);

}

/****************************************************************************/ void rst_clr(long address)

{

/* Reset and clear the digitizer and memory card */

IOOUTPUTS(address, "*RST;*CLS", 9);

}

/****************************************************************************/ void check_error(char *array, long address)

{

char into[161]; intlength = 160;

IOOUTPUTS(address, "SYST:ERR?", 9);

/* Query error register */

IOENTERS(address, into, &length);

 

/* Enter error message */

if (atoi(into) != 0)

/* Determine if error is present */

 

/* If errors present, print and exit */

{

 

 

while (atoi(into) != 0)

{

printf("Error %s in array %s\n\n", into, array); length = 160;

IOOUTPUTS(address, "SYST:ERR?", 9); IOENTERS(address, into, &length);

}

exit(1);

}

}

86 Using the Digitizer

Chapter 2

Page 86
Image 86
HP E1429A manual Using the Digitizer Chapter