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

Page 33

Advertising
background image

Developing Applications

3–7

Publication 1747-6.5.3 Junel 1998

/*

** Open the scanner

*/
retcode = OC_OpenScanner( &Handle, 0, 0);
if ( retcode != SUCCESS )
{

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

}

/*
** 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 );

Access the
scanner
See page 6-48.

Initialize the
scanner
See pages
6-63, 6-33,
and 6-7.

Advertising
This manual is related to the following products: