Gx6377RelayGetChannels

Purpose

Returns the status of all relays for the specified relay type.

Syntax

Gx6377RelayGetGroupChannels (nHandle, nRelayType, pnStates, pnStatus)

Parameters

Name
Type
Comments
nHandle
SHORT
Handle to a GX6377 board.
nRelayType
SHORT
Specifies the type of relay:
  • GX6377_RELAY_TYPE_HIGH_CURRENT
  • GX6377_RELAY_TYPE_FORM_A
  • GX6377_RELAY_TYPE_FORM_C
pnState
PSHORT
Returned state of all the relays.
pnStatus
PSHORT
Returned status: 0 on success, negative number on failure.

 

Comments

The function returns the states of all the channels (relays) of the specified relay type. Every bit in pnStates represents a channel as follows.

GX6377_RELAY_TYPE_HIGH_CURRENT: bits 0-4 of pnStates are for relays 1-5

GX6377_RELAY_TYPE_FORM_A: bits 0-3 of pnStates are for relays 1-4

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 Gx6377RelayGetChannel function to retrieve the status of a single channel.

Example

The following example checks whether relays 1 and 3 of the high current relays are closed:

 

SHORT nStates;

Gx6377RelayGetChannels(nHandle, GX6377_RELAY_TYPE_HIGH_CURRENT, &nStates, &nStatus);

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

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

 

See Also

Gx6377RelaySetChannels, Gx6377RelayGetChannel, GxSWGetErrorString