Gx6115GetChannels

Purpose

Returns the status of all relays and relays drivers.

Syntax

Gx6115GetChannels (nHandle, plStates, pnStatus)

Parameters

Name
Type
Comments
nHandle
SHORT
Handle to a GX6115 board.
plStates
LPLONG
Returned state of all relays and driver relays. See Comments.
pnStatus
LPSHORT
Returned status: 0 on success, negative number on failure.

Comments

The function returns the status of all the channels (relays) in a single 32-bit long pointer plStates. The low order bits 0-14 are for relays 1-15 and bits 16-18 are for relay drivers 1-3 respectively. For each bit, a value of 0 indicates that the channel is open while a value of 1 indicates that the channel is closed.

Use Gx6115GetChannel function instead to retrieve the status of a single channel.

Example

The following example checks whether relays 1 and 3 are closed:

 

Gx6115GetChannels(nHandle, &lStates, &nStatus);

if ((lStates & 0x5) == 0x5) // binary ..0000101

printf(“Relay 1 and 3 are closed”);

 

See Also

Gx6115Initialize, GxSWGetErrorString, Gx6115GetChannel, Gx6115SetChannels