Returns the status of all relays.
Gx6125GetChannels (nHandle, plChannelsState, pnStatus)
Name |
Type |
Comments |
nHandle |
SHORT |
Handle to a GX6125 board. |
plChannelsStates |
PLONG |
Returned state of relays 1-25. |
pnStatus |
PSHORT |
Returned status: 0 on success, negative number on failure. |
The function returns the state of all the channels (relays) in one 32-bit long variables, plChannelsState. Every bit in plChannelsState represents a channel. The bits 0-24 of for relays 1-25. 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 Gx6125GetChannel function to retrieve the status of a single channel.
The following example checks whether relays 1 and 3 are closed:
Gx6125GetChannels(nHandle, &lChannelsState,
&nStatus);
if ((lChannelsState & 0x5) == 0x5) // binary ..0000101
printf(“Relay 1 and 3 are closed”);
Gx6125Intialize, Gx6125GetChannel, Gx6125SetChannels, GxSWGetErrorString