/* Decode the second integer */

result = config [1];

/* Terminal Module */

if (result > 0)

 

{

printf (“Module does NOT have a terminal module installed\n”);

}

else

{

printf (“Module has a screw-type terminal module installed\n”);

}

/* Decode the third integer */

result=config[2]; /* Isolated or non-isolated outputs */

if (num_chan < 9) result = result << 8; /* strip upper 8 bits */ for (i=num_chan;i>0;i – –)

{

if (result >= 0x8000)

{

printf (“Channel %d is configured for non-isolated output\n”,i);

}

else

{

printf(“Channel %d is configured for isolated output\n”,i);

}

result = result << 1;

}

/* Decode the fourth integer */

result=config[3]; /* Output Mode Voltage or Current */ if (num_chan < 9) result = result << 8; /* strip upper 8 bits */ for (i=num_chan;i>0;i – –)

{

if (result >= 0x8000)

{

printf (“Channel %d is set to voltage output mode\n”,i);

}

else

{

printf(“Channel %d is set to current output mode\n”,i);

}

result = result << 1;

}

Chapter 2

Programming Examples 43

Page 43
Image 43
HP E1418A manual Chapter Programming Examples