Rockwell Automation 1747-PCIS API Software - Open Controller User Manual

Page 40

Advertising
background image

Publication 1747-UM002A-US-P - June 2000

3-8 Developing Applications

}
printf( ”\n\n Switch position: ” );
switch( swpos )
{

case SWITCH_TOP:

printf( ”Top \n” );
break;

case SWITCH_BOTTOM:

printf( ”Bottom \n” );
break;

case SWITCH_MIDDLE:

printf( ”Middle \n” );
break;

}
delay( 3000 );
/*
** Read auto-config
*/
retcode = OC_GetIOConfiguration( Handle, &OCcfg );
if ( retcode != SUCCESS )
{

printf( ”\nERROR: OC_GetIOConfiguration failed: %d\n”, retcode );
Ioexit( 1 );

}
/*
** Display rack configuration
*/
slots = OCcfg.Rack1Size + OCcfg.Rack2Size + OCcfg.Rack3Size;
if ( slots > 31 )

slots = 31;

printf( ”\n\n Chassis configuration ” );
for ( i=1; i < slots; i++ )
{

if ( OCcfg.SlotCfg[i].type != 0xff )

printf( ”\n Slot %2d: Type %2d, Mix %3d %s”,

i, OCcfg.SlotCfg[i].type, OCcfg.SlotCfg[i].mix,
OCcfg.SlotCfg[i].Name );

else

printf( ”\n Slot %2d: %s”, i, OCcfg.SlotCfg[i].Name );

/* Find digital input card */
if ( OCcfg.SlotCfg[i].mix < 8 && !input_found )
{

input_found = 1;
input_slot = i;

}
/* Find digital output card */
if ( (OCcfg.SlotCfg[i].mix > 7) && (OCcfg.SlotCfg[i].mix < 32) && !output_found

)

{

output_found = 1;
output_slot = i;

}

}
delay( 3000 );

Advertising
This manual is related to the following products: