Gx6188GetRelayStates

Purpose

Returns the state (open or closed) of each relay on the device specified.

Syntax

Gx6188GetRelayStates (nHandle, padwRelayStates, pnMaxLen, pnStatus)

Parameters

Name
Type
Comments
nHandle
SHORT
Handle to a GX6188 board.
padwRelayStates  
PDWORD
Returns an array containing each relay's state (open or closed)  
pnMaxLen
PSHORT
Size of the array passed into the padwRelayStates parameter
The function returns the actual number of elements written to the array in this variable as well.
pnStatus
PSHORT
Returned status: 0 on success, negative number on failure.

Comments

Each element in the relay count array, padwRelayCount, represents the current state of a relay on the board. The element index corresponds with the relay designation number minus one. For example, element 0 in the array contains the relay state for the relay designated "K1", element 1 in the array contains the relay state for the relay designated "K2", and so on.

Example

The following example returns the relay state for relay K200 on a rear transition board that is connected to slot 5:

 

SHORT nHandle, nStatus, nMaxRelay;

DWORD adwRelayStates[256];

 

nMaxRelay=256;

Gx6188Initialize (5, &nHandle, &nStatus);

Gx6188GetRelayStates (nHandle, adwRelayStates, &nMaxRelay, &nStatus);

if (adwRelayStates[199]==GX6188_RELAY_OPEN)

    printf("Relay K200 is open");

else

    printf("Relay K200 is closed");

 

See Also

Gx6188GetRelayCount, GxSWGetErrorString