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

Page 39

Advertising
background image

Publication 1747-UM002A-US-P - June 2000

Developing Applications 3-7

/*
** Reset the scanner
*/
printf( ”\n\n Going to reset OC, takes 6 seconds to complete...\n” );

retcode = OC_ResetScanner( Handle, OCWAIT );
if ( retcode != SUCCESS )
{

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

}
/*
** Check scanner status register
*/
retcode = OC_GetScannerStatus( Handle, &status );
if ( retcode != SUCCESS )
{

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

}
if ( status != SCANSTS_INIT)
{

printf(”\nERROR: POST failure detected: %d\n”, status);
Ioexit(1);

}
/*
** Initialize the DPR partitions
** You can use OC_CreateIOConfiguration to determine the I/O image

table

** sizes before paritioning the DPR
*/
ocpart.OutputImageSize = 0x800;
ocpart.InputImageSize = 0x800;
ocpart.HostRetentiveDataSize = 0;
retcode = OC_InitScanner( Handle, &ocpart );
if ( retcode != SUCCESS )
{

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

}
/*
** Display software/hardware versions
*/
retcode = OC_GetVersionInfo( Handle, &verinfo );
if ( retcode != SUCCESS )
{

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

}
printf( ”\n\n Scanner Firmware Series: %02d Revision: %02d ”,

verinfo.ScannerFirmwareSeries, verinfo.ScannerFirmwareRevision );

printf( ”\n Hardware Series: %02d Revision: %02d”,

verinfo.OCHardwareSeries, verinfo.OCHardwareRevision );

delay( 3000 );
/*
** Read switch position
*/
retcode = OC_GetSwitchPosition( Handle, &swpos );
if ( retcode != SUCCESS )
{

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

Initialize the
scanner

Advertising
This manual is related to the following products: