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

Page 83

Advertising
background image

OC_GetLastFaultCause

Library of Routines

6–29

Publication 1747-6.5.3 June 1998

OC_GetLastFaultCause

OC_GetLastFaultCause retrieves the cause of the last fault.

Syntax:

int

OC_GetLastFaultCause(HANDLE handle, BYTE *FaultCode, int *SlotNum);

Parameters:

Description:

When the scanner faults, an extended error is generated. The error code and slot number of the most recent
fault is retained and returned by this function. The fault cause is a duplicate of the most recent extended error.

The OC_ClearFault function clears the fault in the scanner but does not clear the cause of the last fault.

See Appendix A for error codes.

Return Value:

Considerations:

Supported in the DOS API library and the Windows NT API library

Example:

HANDLE

Handle;

BYTE

status, FaultCause;

int

FaultSlot;

int

retcode;

OC_GetScannerStatus ( Handle, &status );
if ( status = SCANSTS_FAULT )
{

retcode = OC_GetLastFaultCause ( Handle, &FaultCause, &FaultSlot );

}

Parameter:

Description:

handle

Must be a valid handle returned from OC_OpenScanner

FaultCode

Points to the address that contains the fault cause
If the value returned in

FaultCode

is 0, the scanner has not received

any faults since it has been reset.

SlotNum

Slot number that caused the fault

Name:

Value:

Description:

SUCCESS

0

fault was cleared successfully

ERR_OCACCESS

2

handle

does not have access to scanner

ERR_OCINIT

5

scanner has not been initialized, see OC_InitScanner

Advertising
This manual is related to the following products: