Returns the status of all relays and relays drivers at the specified group.
Gx6315GetGroupChannels (nHandle, nGroup, plStates, pnStatus)
Name |
Type |
Comments |
nHandle |
SHORT |
Handle to a GX6315 board. |
nGroup |
SHORT |
Group on the GX6315 board. 0-2: 0 for group A, 1 for group B and 2 for group C. |
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 Gx6315GetChannel function to retrieve the status of a single channel.
The following example checks whether relays 1 and 3 are closed:
Gx6315GetGroupChannels(nHandle, nGroup, &lStates, &nStatus);
if ((lStates & 0x5) == 0x5) // binary ..0000101
printf("Relay 1 and 3 are closed");
Gx6315Initialize, GxSWGetErrorString,Gx6315GetChannel, Gx6315SetGroupChannels.
.