/* Decode the fifth integer */
result=config[4]; /* Channel relay open or closed */
if (num_chan < 9) result = result << 8; /* strip upper 8 bits */ for (i=num_chan;i>0;i –
{
if (result >= 0x8000)
{
printf (“Channel %d output is disabled\n”,i);
}
else
{
printf(“Channel %d output is enabled\n”,i);
}
result = result << 1;
}
/* Decode the sixth integer */
result=config[5]; /* P/J Jumper position */
if (num_chan < 9) result = result << 8; /* strip upper 8 bits */ for (i=num_chan;i>0;i –
{
if (result >= 0x8000)
{
printf (“Channel %d output mode is programmable\n”,i);
}
else
{
printf(“Channel %d output mode is fixed and jumper selected\n”,i);
}
result = result << 1;
}
∙
∙
∙
}
44 Programming Examples | Chapter 2 |