Gx6196GetChannel

Purpose

Return the state of a relay.

Syntax

Gx6196GetChannel (nHandle, nChannel, pnState, pnStatus)

Parameters

Name
Type
Comments
nHandle
SHORT
Handle to a GX6196 board.
nChannel
SHORT
Specified Relay to get state (0-95).
pnState
PSHORT
Returned state of the relay. 1 for close and 0 for open.
pnStatus
PSHORT
Returned status: 0 on success, negative number on failure.

Comments

Returns the state of a relay (K1 to K96). Note that the relays marked K1 to K96 are addressed as Channel 0 to 95.

Example

The following example checks whether relay 95 is closed:

 

Gx6196GetChannel(nHandle, 95, &nState, &nStatus);

if (nState==1)

    printf(“Relay 95 is closed”);

else

    printf(“Relay 95 is open”);

 

See Also

Gx6196Close, Gx6196Open, GxSWGetErrorString