/* 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
}
/* Decode the third integer */
result=config[2]; /* Isolated or
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
}
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 |