Handling interrupt messages, Handling errors, Determining partition sizes for shared memory – Rockwell Automation 1747-PCINT API Software for 1746 I/O User Manual

Page 44

Advertising
background image

3–18

Developing Applications

Publication 1747-6.5.3 June 1998

Handling Interrupt
Messages

Modules that communicate via discrete input interrupts or module interrupts require
special attention. The API buffers these interrupts internally until they are extracted
via OC_PollScanner. The internal message buffer can hold as many as 5 messages.
If the message buffer is full, the oldest message in the buffer is overwritten by the
next message. Interrupts will be missed if OC_PollScanner is not called by the
application more often than interrupts are received.

For Windows NT, use the OC_WaitForxxx functions.

Handling Errors

Every function call returns a status code for the function. Check this status code
before using the data returned by the function. The scanner reports faults and other
errors via messages. The API library buffers these errors internally and reports their
existence as an Extended Error. The application must periodically call
OC_GetExtendedError to determine if an extended error message exists.

The library buffers extended errors in a queue. The queue can hold as many as 5
extended errors at one time. If the queue is full when a new extended error is received
from the scanner, the oldest extended error is lost and ERR_OCOVERRUN is
returned. The host application must call OC_GetExtendedError periodically to
remove existing extended errors from the buffer.

Extended Errors cause the scanner to fault. Once the scanner is faulted, it is forced
to Idle mode and cannot go to Scan mode until the Extended Errors are extracted
via OC_GetExtendedError and the fault is cleared via OC_ClearFault. For Windows
NT, use the OC_WaitForExtError function.

Determining
Partition Sizes for
Shared Memory

The host application initializes the scanner by providing partitioning information,
which contains the size of memory to be reserved in the shared memory for the
input and output images. The size of memory to be reserved for each of the images
must be greater than or equal to the number of input and output words required by
each module. The host application can’t communicate with the scanner until it has
been initialized.

The partitioning information is passed to OC_InitScanner in the OCINIT structure,
which is defined as:

typedef struct tagOCINIT {

WORD OutputImageSize; /* size in bytes */
WORD InputImageSize; /* size in bytes */
WORD HostRetentiveDataSize; /* size in bytes */

} OCINIT;

Advertising
This manual is related to the following products: