Gx6192/Gx6256/Gx6864InterruptSetup

Purpose

Configures the behavior of the interrupts.

Syntax

Gx6256InterruptSetup (nHandle, wAutoInterrupts, wPCIInterrupts, pInterruptCallback, pvInterruptCallbackParam, dDelay, pnStatus)

Parameters

Name
Type
Comments
nHandle
SHORT
Handle to a GX6256/GX6864/GX6192 board. .
wAutoInterrupts
WORD
Bitfield for selecting which interrupt source can cause the automatic opening of all relays to occur.
1. GX6256_INTERRUPT_0
2. GX6256_INTERRUPT_1
4. GX6256_INTERRUPT_2
wPCIInterrupts
WORD
Bitfield for selecting which interrupt source can cause a PCI interrupt to occur.
1. GX6256_INTERRUPT_0
2. GX6256_INTERRUPT_1
4. GX6256_INTERRUPT_2
pInterruptCallback
Gt_EventCallback
Callback procedure / Interrupt handler that is called when a PCI interrupt has occurred
pvInterruptCallbackParam
PVOID
Parameter that will be passed to the user interrupt handler procedure (pInterruptCallback)
dDelay
DOUBLE
Delay, in seconds, which will occur before an interrupt event causes all relays to be forced open.
pnStatus
PSHORT
Returned status: 0 on success, negative number on failure.

Comments

There are two methods to respond to an interrupt: open all relays or execute a callback procedure.  If all of the relays are opened, you must call Gx6256InterruptReset to return to normal operation.  If a callback procedure is executed, you must call Gx6256InterruptResume to return to normal operation.  This call is usually made from with the interrupt handler.

The callback function must match the following prototype where InterruptHandler can be any name.  The nEventType will match the interrupt source (i.e. GX6256_INTERRUPT_0):

InterruptHandler(SHORT nHandle, SHORT nEventType, PVOID pvUserData);

Example

The following example sets the board up to open all relays 3 seconds after Interrupt 0 occurs.  It also calls an interrupt handler procedure called MyInterruptHandler, if Interrupt 1 or 2 occur:

 

SHORT nStatus;

SHORT nParam=500;

 

Gx6256InterruptSetup(nHandle, GX6256_INTERRUPT_0, GX6256_INTERRUPT_1 | GX6256_INTERRUPT_2,

    MyInterruptHandler, (PVOID)nParam, 3, &nStatus);

 

See Also

Gx6256InterruptDisable, Gx6256nterruptGetStatus, Gx6256InterruptReset, Gx6256InterruptResume, GxSWGetErrorString