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

Page 41

Advertising
background image

Publication 1747-UM002A-US-P - June 2000

Developing Applications 3-9

/*
** Download the configuration to the scanner
*/
retcode = OC_DownloadIOConfiguration( Handle, &OCcfg );
if ( retcode != SUCCESS )
{

printf( ”\nERROR: OC_DownloadIOConfiguration failed: %d\n”,

retcode );

Ioexit( 1 );

}

/*
** Set output update mode to always
*/
retcode = OC_SetOutputUpdateMode( Handle, OUTUPD_ALWAYS );
if ( retcode != SUCCESS )
{

printf( ”\nERROR: OC_SetOutputUpdateMode failed: %d\n”,

retcode );

Ioexit( 1 );

}
/*
** Set scan time to 5ms, periodic scan mode
*/
retcode = OC_SetScanTime( Handle, SCAN_PERIODIC, 20 );
if ( retcode != SUCCESS )
{

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

}
/*
** Goto Scan Mode
*/
retcode = OC_SetScanMode( Handle, SCAN_RUN );
if ( retcode != SUCCESS )
{

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

}
/*
** Turn on User LED 1
*/
retcode = OC_SetUserLEDState( Handle, 1, LED_GREEN_SOLID );
if ( retcode != SUCCESS )
{

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

}
printf( ”\n\n LED1 is on solid green now. \n” );
delay( 3000 );

Configure
the
scanner.

Control scanner
operation

Advertising
This manual is related to the following products: