Gx6315GetChannel

Purpose

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

Syntax

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

Parameters

Name
Type
Comments
nHandle
SHORT
Handle to a GX6315 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-45 for the high current relay,  1-9 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 Gx6315GetGroupChannels to retrieve the status of all channels of a group in one function call.

Example

The following example return the status of relay 1:

 

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

if (nClose==1)

printf("Relay 1 is Close");

else

printf("Relay 1 is Open");

 

See Also

 Gx6315Initialize, GxSWGetErrorString, Gx6315Close, Gx6315Open,Gx6315SetGroupChannels.