Initialize the scanner -3 configure the scanner -3 – Rockwell Automation 1747-PCINT API Software for 1746 I/O User Manual

Page 29

Advertising
background image

Developing Applications

3–3

Publication 1747-6.5.3 Junel 1998

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.

The API has a defined constant specifying the total number of bytes available for
the three segmenters This constant is specified as:

OCSEGMENTSIZELIMIT

Once the scanner has been initialized properly it cannot be re-initialized unless it
is reset with the OC_ResetScanner function. Once the scanner is reset, scanner
communications are disabled again until the scanner is initialized. The host
application can call OC_GetScannerStatus to determine if the scanner has been
initialized.

If the scanner was previously initialized, the host application can retrieve the
initialization partition information with the OC_GetScannerInitInfo function
instead of resetting and re-initializing the scanner.

Configure the scanner

To access I/O modules in a rack, you must define the rack sizes and installed module
types for the scanner. You can either create a specific configuration or read the
current configuration. The scanner cannot be set to Scan mode until it has been
configured (received a valid scanner configuration).

If the scanner is in Scan mode and the host application has not downloaded a scanner
configuration, the scanner has already been configured. To control I/O, use
OC_GetIOConfiguration to retrieve the current scanner configuration.

Advertising
This manual is related to the following products: