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

Publication 1747-UM002A-US-P - June 2000
3-6 Developing Applications
/*=======================================================================
= INCLUDE FILES =
=========================================================================*/
#include ”ocapi.h”
#include
#include
#include
#include
#include
/*=======================================================================
= MODULE WIDE GLOBAL VARIABLES =
=========================================================================*/
HANDLE
Handle;
/* Software ID to scanner device */
OCIOCFG
OCcfg;
/* Chassis I/O config. data structure */
/*=======================================================================
= FUNCTION PROTOTYPES =
=========================================================================*/
void Ioexit( int );
/*=======================================================================
= MAIN PROGRAM =
=========================================================================*/
void main()
{
int
retcode;
/* Return code from API calls */
int
i;
int
slots;
int
input_slot, input_found = 0;
int
output_slot, output_found = 0;
OCINIT
ocpart;
BYTE
status;
OCVERSIONINFO
verinfo;
BYTE
swpos;
WORD
wData;
/*
** Open the scanner
*/
retcode = OC_OpenScanner( &Handle, 0, 0);
if ( retcode != SUCCESS )
{
printf( ”\nERROR: OC_OpenScanner failed: %d\n”, retcode );
Ioexit( 1 );
}
Access the
scanner.