Gx6138GetChannels

Purpose

Returns the status of all relays in the specified board.

Syntax

Gx6138GetChannels (nHandle, nGroup, plHighChStates, plLowChState,pnStatus)

Parameters

Name
Type
Comments
nHandle
SHORT
Handle to a GX6138 board.
plHighChStates
LPLONG
Returned state of relays 33-38.
plLowChStates
LPLONG
Returned state of relays 1-32.
pnStatus
LPSHORT
Returned status: 0 on success, negative number on failure.

     

Comments

The function returns the state of all the channels (relays) of a specified board in two 32-bit long variables,  plHighChStates and plLowChStates. Every bit in plxxxStates represents a channel. The bits 0-31 of lLowChStates are for relays 1-32 and bits 0-5 of lHighChStates are for relays 33-38 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 Gx6138GetChannel function to retrieve the status of a single channel.

Example

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

 

Gx6138GetChannels(nHandle, &lHighChStates,

&lLowChStates, &nStatus);

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

printf("Relay 1 and 3 are closed");

 

See Also

Gx6138Initialize, GxSWGetErrorString, Gx6138GetChannel, Gx6138SetChannels