Rockwell-automation 1747-PCINT API Software for 1746 I/O Uživatelský manuál Strana 42

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 155
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 41
3–16 Developing Applications
Publication 1747-6.5.3 June 1998
/* Read auto-config */
if (SUCCESS != (rc = OC_GetIOConfiguration(OChandle, &OCcfg)))
{
printf("\nERROR: OC_GetIOConfiguration failed: %d\n", rc);
Ioexit(1);
}
/* Display rack configuration */
slots = OCcfg.Rack1Size + OCcfg.Rack2Size + OCcfg.Rack3Size;
if ( slots > 31 ) slots = 31;
printf("\n\nRack configuration:");
for (i=1; i<slots; i++)
{
if (OCcfg.SlotCfg[i].type != 0xff)
{
printf("\nSlot %2d: Type %2d, Mix %3d %s",
i, OCcfg.SlotCfg[i].type, OCcfg.SlotCfg[i].mix,
OCcfg.SlotCfg[i].Name);
}
else
{
printf("\nSlot %2d: %s", i, OCcfg.SlotCfg[i].Name);
}
/* check for BAS modules class 1 or 4 */
if ( ((OCcfg.SlotCfg[i].mix == 35) || (OCcfg.SlotCfg[i].mix == 131))
&& (OCcfg.SlotCfg[i].type == 6))
{
if ( OCcfg.SlotCfg[i].mix == 35 )
{ /* if Class 1 BAS module, then ...
OCcfg.SlotCfg[i].mix = 131; /* ...make it class 4 */
OCcfg.SlotCfg[i].Name = NULL; /* remove name so that OC_CreateIOConfiguration
will key off mix/type */
fRecreateIOcfg = 1;
}
BASslot = i;
}
/* check for IB32 modules */
if ( OCcfg.SlotCfg[i].mix == 7 )
{
IB32slot = i;
}
}
/* if we converted a Class 1 BAS module to Class 4, recreate the IO configuration */
/* to insure we get the M0 and M1 file sizes */
if (fRecreateIOcfg == 1)
{
if (SUCCESS != (rc = OC_CreateIOConfiguration(&OCcfg)))
{
printf("\nERROR: OC_CreateIOConfiguration failed: %d\n", rc);
Ioexit(1);
}
}
/* Download the configuration to the scanner */
if (SUCCESS != (rc = OC_DownloadIOConfiguration(OChandle, &OCcfg)))
{
printf("\nERROR: OC_DownloadIOConfiguration failed: %d\n", rc);
Ioexit(1);
}
Configure
the scanner
See page
6-11.
Zobrazit stránku 41
1 2 ... 37 38 39 40 41 42 43 44 45 46 47 ... 154 155

Komentáře k této Příručce

Žádné komentáře