Access the scanner -2 initialize the scanner -2, Access the scanner, Initialize the scanner – Rockwell Automation 1747-PCIS API Software - Open Controller User Manual

Page 34

Advertising
background image

Publication 1747-UM002A-US-P - June 2000

3-2 Developing Applications

Access the scanner

The host application must first call OC_OpenScanner to gain access to
the scanner. Once an application has access, no other application can
gain access to the scanner. When the application no longer requires
access to the scanner, it must call OC_CloseScanner to release access
of the scanner to other applications.

Once the scanner is opened, you must call OC_CloseScanner before
exiting the application.

Initialize the scanner

After the scanner is reset and performs its POST, the scanner waits for
initialization. In this state, the scanner can’t be configured or control I/
O. The only operational function is that which controls the LEDs. Any
call to a function that requires the scanner to be initialized returns an
error. You must initialize the scanner by sending it partitioning
information before the host application can communicate with the
scanner.

Initialize the scanner by calling the OC_InitScanner function to send
the scanner partitioning information, which defines in bytes the size of
the output image, the input image, and the host retentive data. Each
of these memory segments must be at least large enough to hold their
respective data, and must be an even number. If the input or output
partition is initialized smaller than the actual size of the input or
output image for a configuration, the OC_DownloadIOConfiguration
function returns an error. The host retentive data size is optional and
can be 0.

To determine the input image and output image sizes, use the
OC_CreateIOConfiguration function to create an I/O configuration.
OC_CreateIOConfiguration returns an I/O configuration with the
number of bytes of inputs and outputs for each module. If a
configuration already exists, you can use OC_GetIOConfig to return
the current I/O configuration. The application can then calculate the
minimum size of the segments required to hold the input and output
images. For more information, see page 3-18.

Advertising
This manual is related to the following products: