Rockwell Automation 1747-PCINT API Software for 1746 I/O User Manual
Page 35

Developing Applications
3–9
Publication 1747-6.5.3 Junel 1998
/*
** 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
See page
6-11.