
Example: Positive
Voltage Compliance
This program checks the MEASURED voltage output from the DAC
channel being tested. If the measured channel output is
≥
15.0V when the
output stops increasing, the program generates a "Test PASSED" indication.
If the measured channel output is < 15.0V when the output stops increasing,
the program generates a "Test FAILED" indication.
/* Positive Voltage Compliance Test E1328A */
#include <stdio.h>
#include <sicl.h>
#define ADDR "hpib7,9,9"
/* Address of device */
void main ()
{
INST id;
/* Define id as an instrument */
float source = 0, value = 0, old_value = 0, result = 0;
int chan;
char *pass;
#if defined(__BORLANDC__) && !defined(__WIN32__)
_InitEasyWin();
#endif
ionerror(I_ERROR_EXIT);
/* Exit on error */
id = iopen (ADDR);
/* Open instrument session */
itimeout (id, 10000);
/* Set 10 sec timeout */
for(chan = 1; chan <= 4; chan++)
{
iprintf (id, "CAL%u:STAT OFF\n", chan);
iprintf (id, "VOLT%u MAX\n", chan);
source = 4.5;
value = 0;
printf ("\nVoltage Compliance Tests on Channel %u", chan);
do
{
source = 0.5;
old_value = value;
printf("\n Set source to %.1f Volts DC", source);
printf("\n Measure channel output (in V)");
printf("\n Enter channel output (in V): ");
scanf ("%f", &value);
printf("\n DC Source value = %.1f VDC", source);
printf("\n Channel %u output = %.1f VDC", chan, value);
result = value - old_value;
}
while (result != 0);
62 Verification Tests - C Programs
Appendix B