Returns the status of all relays and relays drivers.
Gx6115GetChannels (nHandle, plStates, pnStatus)
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. |
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.
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”);
Gx6115Initialize, GxSWGetErrorString, Gx6115GetChannel, Gx6115SetChannels