Gx6115GetChannel

Purpose

Returns whether the specified relay or relay driver at the specified board is open or closed.

Syntax

Gx6115GetChannel (nHandle, nRelayType, nChannel, pnState, pnStatus)

Parameters

Name
Type
Comments
nHandle
SHORT
Handle to a GX6115 board.
nrelayType
SHORT
Specifies the type of relay 0-1:
0 for the high current relay
1 for the driver relay.
nChannel
SHORT
Specifies the relay number. Can be 1-15 for the high current relay, 1-3 for the driver relay.
pnState
LPSHORT
Returned relay state. Closed = 1 and Open = 0.
pnStatus
LPSHORT
Returned status: 0 on success, negative number on failure.

Comments

Use the Gx6115GetChannels to retrieve the status of all channels in one function call.

Example

The following example return the status of relay 1:

 

Gx6115GetChannel(nHandle, 0, 1, &nClose, &nStatus);

if (nClose==1)

printf(“Relay 1 is Close”);

else

printf(“Relay 1 is Open”);

 

See Also

Gx6115Initialize, GxSWGetErrorString, Gx6115Close, Gx6115Open, Gx6115GetChannels